Summary of using abap to call external webservice

Source: Internet
Author: User

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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.