且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

在SAP ABAP 里consume webservice的全过程

更新时间:2022-08-22 12:57:20

可以跑通。

The function module being exposed as web service looks like below:在SAP ABAP 里consume webservice的全过程

wsdl: http://ldcix3d.jerry.corp:50024/sap/bc/srt/wsdl/flv_10002A111AD1/bndg_url/sap/bc/srt/rfc/sap/zsd_add/700/zadd/zb_add?sap-client=700

SE80, click create button:


在SAP ABAP 里consume webservice的全过程

select “Service Consumer”:在SAP ABAP 里consume webservice的全过程在SAP ABAP 里consume webservice的全过程在SAP ABAP 里consume webservice的全过程

input WSDL url:

在SAP ABAP 里consume webservice的全过程

There is a pop up window. Maintain user and password accordingly.在SAP ABAP 里consume webservice的全过程

Activate the proxy class, the status should be Active:

在SAP ABAP 里consume webservice的全过程

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

在SAP ABAP 里consume webservice的全过程

Create a new logical port:

在SAP ABAP 里consume webservice的全过程

在SAP ABAP 里consume webservice的全过程

在SAP ABAP 里consume webservice的全过程

在SAP ABAP 里consume webservice的全过程

在SAP ABAP 里consume webservice的全过程

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

在SAP ABAP 里consume webservice的全过程

  1. Create a test report like below:
  2. 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.

在SAP ABAP 里consume webservice的全过程

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

specify the default logical port, and click button “Create Instance”:在SAP ABAP 里consume webservice的全过程在SAP ABAP 里consume webservice的全过程

specify 3 and 4 as input para1 and input para2:

在SAP ABAP 里consume webservice的全过程

execute and get expected result 7:

在SAP ABAP 里consume webservice的全过程