Abap calls an external web service in the following three steps:
1. se80, select package, and click Create enterprise service/web service-proxy client
2. lpconfig: Create a logical Port
3. Call the created proxy class programmatically.
Note: This instance must be of the ecc version.
I. Create a proxy class
A. Select a package, click Create enterprise service/web service-proxy client, and click Continue to select
Service consumer
B. url/http destination. Click continue.
C. Select the url and enter the wsdl address. If it is a local host, you must change it to the local address.
D. Click "continue" and enter "select package" and "prefix.
If no error exists, a proxy class is generated based on the wsdl file and activated.
2. Create the logical port lpconfig or SOAMANAGER
Enter the proxy class, logical port name, which can be set as the default port
A. In general settings, select the web service infrastructure as the runtime environment.
Call parameters: Enter the web service address in the url text box.
Operation: Enter the soapAction defined in the wsdl in the soap operation for each specific method.
B. Specific settings in the Application
Message tag and status management are enough in global settings.
Save Activation
3. encode specific requirements.
REPORT ztest.
DATA: obj_certif type ref to ytcertifco_certificate_request,
Obj_output TYPE ytcertifhello_world_soap_out,
Obj_input TYPE ytcertifhello_world_soap_in,
Wa_obj_input LIKE prxctrl,
Erro_msg TYPE string,
Obj_exception type ref to cx_ai_system_fault.
TRY.
Create object obj_certif
EXPORTING
Logical_port_name = 'lp01 '.
CATCH cx_ai_system_fault INTO obj_exception.
Call method obj_exception-> get_text
Processing ing
Result = erro_msg.
WRITE/1 erro_msg.
ENDTRY.
* Wa_obj_input-field = 'head world '.
* Wa_obj_input-value = '1 '.
* APPEND wa_obj_input TO obj_input-controller.
TRY.
Call method obj_certif-> hello_world
EXPORTING
Input = obj_input
IMPORTING
Output = obj_output.
WRITE: obj_output-hello_world_result.
CATCH cx_ai_system_fault INTO obj_exception.
Call method obj_exception-> get_text
Processing ing
Result = erro_msg.
WRITE/1 erro_msg.
ENDTRY.