ABAP 创建和调用WebService

1、创建WebService

  ① SE37创建RFC函数

  ② SE80创建企业服务-service provider-existing ABAP object

    或SE37-实用程序-创建Web服务

  ③ SOAManager-web服务配置-创建服务

2、调用WebService

  ① SE80创建企业服务-service consumer-externe WSDL-URL

  ② SOAManager 创建基于WSDL的配置-端口(ZPORT1)

  ③ ABAP调用    

DATA: lo_clientproxy   TYPE REF TO zcl_co_hr_sap_service_port_typ,
lo_sys_exception TYPE REF TO cx_ai_system_fault,
lo_app_exception TYPE REF TO cx_ai_application_fault,
    l_input TYPE zcl_create_dept_request,
    l_output TYPE zcl_create_dept_response.
TRY.
CREATE OBJECT lo_clientproxy
EXPORTING
logical_port_name = 'ZPORT1'.
CALL METHOD lo_clientproxy->create_dept
EXPORTING
create_dept_request = l_input
IMPORTING
create_dept_response = l_output.
  CATCH cx_ai_system_fault INTO lo_sys_exception.
MESSAGE lo_sys_exception->errortext TYPE 'I'.
EXIT.
  CATCH cx_ai_application_fault INTO lo_app_exception .
MESSAGE lo_app_exception->textid TYPE 'I'.
EXIT.
ENDTRY.
上一篇:ABAP调用WebService时日期类型问题


下一篇:20170326 ABAP调用外部webservice实例