how to consume a webservice via ABAP proxy

110 阅读1分钟

The function module being exposed as web service looks like below:

wsdl: ldcix3d.wdf.sap.corp:50024/sap/bc/srt/…

SE80, click create button:

select “Service Consumer”:

input WSDL url:

There is a pop up window. Maintain user and password accordingly.

Activate the proxy class, the status should be Active:

  1. search the just created consumer proxy ZCO_ZSD_ADD in SOAMANAGER:

Create a new logical port:

Click the ping button to ensure the logical port works correctly:

  1. Create a test report like below:
REPORT ZJERRY_WS_TEST.
DATA: LO_PROXY TYPE REF TO ZCO_ZSD_ADD,
      INPUT TYPE ZADD_OPERATION,
      OUTPUT TYPE ZADD_OPERATIONRESPONSE.
CREATE OBJECT LO_PROXY
   EXPORTING
     LOGICAL_PORT_NAME = 'ZJERRY'.
INPUT-IV_PARA1 = 1.
INPUT-IV_PARA2 = 3.
try.
CALL METHOD LO_PROXY->ZADD_OPERATION
  EXPORTING
     INPUT = INPUT
  IMPORTING
     OUTPUT = OUTPUT.
CATCH CX_ROOT into DATA(CX_ROOT).
   WRITE: / CX_ROOT->GET_TEXT( ).
   RETURN.
endtry.
WRITE: / 'result: ' , output-RV_RESULT.

Or you can directly test the ABAP consumer proxy class in SE24:

specify the default logical port, and click button “Create Instance”:

specify 3 and 4 as input para1 and input para2:

execute and get expected result 7:

要获取更多Jerry的原创文章,请关注公众号"汪子熙":