Registration

Dear SAP Community Member,
In order to fully benefit from what the SAP Community has to offer, please register at:
http://scn.sap.com
Thank you,
The SAP Community team.
Skip to end of metadata
Go to start of metadata

Consuming Web Services with ABAP - WSDL

To get the process started, we turn to SE80 TCODE go to workbench & edit object.
From the Enterprise Services Tab, we are going to select Client Proxy and then hit new create button.

Next up we have to choose where our WSDL file is going to come from.
But in this case we are going to connect directly to the WSDL definition to a file on our local machine.

Give the path of WSDL file .

Now we are asked what Package we want to place the generated object in as well as what prefix we want to use. I am going to make the object Local Private by putting in my $TMP package. To follow SAP naming standards, as well as my company's standards, I will get the object a prefix of ZES_

Activate the Client Proxy.
You can see

  1. ABAP class
  2. Structures and table types to represent all the importing and exporting data.ABAP CLASS

Structures and table types to represent all the importing and exporting data.

Now we need to configure a Logical Port for it.
We can do this in transaction LPCONFIG.
We can configure more than one Logical Port and specify the one we want at runtime. However for this solution we will just configure one port and make it the default.

Inside the definition of the Logical Port we can adjust settings for the Client Proxy.
 settings that were imported from the WSDL definition.

We can then return to SE80 in Enterprise service tag  and perform a test on the WebService by hitting F8. We then get a dialog that allows us to set parameters for our test.

you get a success message like the following:

Now coding In SE38

Error rendering macro 'code': Invalid value specified for parameter 'lang'
PARAMETER: p_isbn(100) TYPE c OBLIGATORY.
DATA:
* Reference variables for proxy and exception class
  lo_clientproxy     TYPE REF TO zes_co_looky_book_service_soap,
  lo_sys_exception   TYPE REF TO cx_ai_system_fault,
* Structures to set and get message content
   ls_request         TYPE zes_get_info_soap_in,
   ls_response        TYPE zes_get_info_soap_out.
**Set the input parameter
ls_request-value = 'INPUT TEST'.
**Create the Proxy and Clall it.
CREATE OBJECT lo_clientproxy.
TRY.
    CALL METHOD lo_clientproxy->get_info
      EXPORTING
        input  = ls_request
      IMPORTING
        output = ls_response.
  CATCH cx_ai_system_fault INTO lo_sys_exception.
*   Error handling
ENDTRY.
COMMIT WORK.
**Write Out the Basic Information
WRITE: / ls_response-value.
  • No labels