1.根据WSDL URL生成服务消费代理
2.生成消费代理
最后可以看到服务提供者和消费者代理
3.编写程序测试
*&---------------------------------------------------------------------*
*& Report YWXT_27
*&---------------------------------------------------------------------*
*&
*&---------------------------------------------------------------------*
REPORT ywxt_27.
DATA: gc_test TYPE REF TO zcl_co_ywx_ws_test02,
gv_port_name TYPE prx_logical_port_name.
DATA: gs_input TYPE zcl_ywx_ws_func_02,
gs_output TYPE zcl_ywx_ws_func_02response.
DATA: gc_fault TYPE REF TO cx_ai_system_fault.
DATA: gv_str TYPE string.
"这里的port_name是上面配置的逻辑端口名称
gv_port_name = 'YTEST_CO_02'.
gs_input-iv_num1 = 3.
gs_input-iv_num2 = 4.
CREATE OBJECT gc_test
EXPORTING
logical_port_name = gv_port_name.
TRY .
*TRY.
CALL METHOD gc_test->ywx_ws_func_02
EXPORTING
input = gs_input
IMPORTING
output = gs_output.
CATCH cx_ai_system_fault INTO gc_fault.
CALL METHOD gc_fault->if_message~get_text
RECEIVING
result = gv_str.
ENDTRY .
IF sy-subrc = 0.
WRITE:/ '操作成功:' && gs_output-ev_num.
ELSE.
WRITE:/ '错误信息:' && gv_str.
ENDIF.
原创文章,作者:Maggie-Hunter,如若转载,请注明出处:https://blog.ytso.com/17997.html