SAP调用外部WebService
- 格式:docx
- 大小:539.32 KB
- 文档页数:8
SAP调用外部WebService 打开事务码SE80.
prefix名称自己定义,需要Z开头.
选中SOAP方式
创建完成后保存,激活.
进入事务码SOAMANAGER.
Search By:选择Consumer Proxy,Field:Both Names.
在WebService地址中找到soapAction的值.
保存.
代码:
data: exc type ref to cx_root.
data: msg type string.
start-of-selection.
data proxy_test type ref to ZWS_QD_3CO_TEST_WEB_SERVICE1SO.
try.
if proxy_test is not bound.
create object proxy_test type ZWS_QD_3CO_TEST_WEB_SERVICE1SO.
endif.
data: input type ZWS_QD_3HELLO_WORLD_SOAP_IN,
output type ZWS_QD_3HELLO_WORLD_SOAP_OUT.
input-AA = sy-uname.
call method proxy_test->HELLO_WORLD
exporting
input = input
importing
output = output.
WRITE : output-HELLO_WORLD_RESULT.
catch cx_ai_system_fault into exc.
msg = exc->get_text( ).
write:/ msg.
endtry.
结果: