免费webservice测试工具(java调用webservice接口)

一、发布webservice

1.se37 创建webservice服务

免费webservice测试工具(java调用webservice接口)(1)

2.TCODE:SOAMANAGER

免费webservice测试工具(java调用webservice接口)(2)

3.定义服务banding:

免费webservice测试工具(java调用webservice接口)(3)免费webservice测试工具(java调用webservice接口)(4)免费webservice测试工具(java调用webservice接口)(5)

输入服务名称,点击下一步:

免费webservice测试工具(java调用webservice接口)(6)免费webservice测试工具(java调用webservice接口)(7)免费webservice测试工具(java调用webservice接口)(8)免费webservice测试工具(java调用webservice接口)(9)免费webservice测试工具(java调用webservice接口)(10)

生成WSDL:

免费webservice测试工具(java调用webservice接口)(11)免费webservice测试工具(java调用webservice接口)(12)免费webservice测试工具(java调用webservice接口)(13)

url输入浏览器和sap登录验证信息,测试wsdl:

免费webservice测试工具(java调用webservice接口)(14)免费webservice测试工具(java调用webservice接口)(15)

至此,webservice发布完成。

二、调用webservice

创建webservice使用者

免费webservice测试工具(java调用webservice接口)(16)

选择Service Consumer

免费webservice测试工具(java调用webservice接口)(17)免费webservice测试工具(java调用webservice接口)(18)免费webservice测试工具(java调用webservice接口)(19)免费webservice测试工具(java调用webservice接口)(20)

这里测试用配置个本地对象

免费webservice测试工具(java调用webservice接口)(21)免费webservice测试工具(java调用webservice接口)(22)

生成代理类:

免费webservice测试工具(java调用webservice接口)(23)

激活所有对象

免费webservice测试工具(java调用webservice接口)(24)

Se80企业服务,可以看到代理类信息:

免费webservice测试工具(java调用webservice接口)(25)

再次回到TCODE:SOAMANAGER,配置代理类的逻辑端口:

免费webservice测试工具(java调用webservice接口)(26)

注意这次搜索”消费者代理”:

免费webservice测试工具(java调用webservice接口)(27)

这里选择基于WSDL配置,后面步骤会比较多,(我测试过其他几个选项都不行):

免费webservice测试工具(java调用webservice接口)(28)

逻辑端口:逻辑端口是指逻辑意义上用于区分服务的端口,如TCP/IP协议中的服务端口,端口号的范围从0到65535,比如用于浏览网页服务的80端口,用于FTP服务的21端口等。由于物理端口和逻辑端口数量较多,为了对端口进行区分,将每个端口进行了编号,这就是端口号。简单来说,ip地址是用来区分主机,端口号是用来区分主机上的不同服务

免费webservice测试工具(java调用webservice接口)(29)免费webservice测试工具(java调用webservice接口)(30)免费webservice测试工具(java调用webservice接口)(31)

一直下一步直到完成

Ping web服务

免费webservice测试工具(java调用webservice接口)(32)免费webservice测试工具(java调用webservice接口)(33)

程序中调用:

DATA:lo_cx_root TYPE REF TO cx_root.

DATA:l_prox_e TYPE REF TO zco_sap_service_port_type.

DATA:lo_sys_exception TYPE REF TO cx_ai_system_fault,

cx_ai_application_fault TYPE REF TO cx_ai_application_fault

IF l_prox_e IS INITIAL.

TRY.

CREATE OBJECT l_prox_e

EXPORTING

logical_port_name = ‘ZLP01’.

CATCH cx_ai_system_fault INTO lo_sys_exception.

IF lo_sys_exception->errortext IS NOT INITIAL.

output-msgty = ‘E’.

output-msgtx = lo_sys_exception->errortext.

APPEND output.CLEAR:output.

EXIT.

ENDIF.

CATCH cx_ai_application_fault INTO cx_ai_application_fault.

ENDTRY.

ENDIF.

invoke_flow_request-in0 = lv_json.

TRY.

CALL METHOD l_prox_e->invoke_flow

EXPORTING

invoke_flow_request = invoke_flow_request

IMPORTING

invoke_flow_response = invoke_flow_response.

CATCH cx_ai_system_fault INTO lo_sys_exception.

IF lo_sys_exception->errortext IS NOT INITIAL.

output-msgty = ‘E’.

output-msgtx = lo_sys_exception->errortext.

APPEND output.CLEAR:output.

EXIT.

ENDIF.

CATCH cx_ai_application_fault INTO cx_ai_application_fault.

ENDTRY.

免责声明:本文仅代表文章作者的个人观点,与本站无关。其原创性、真实性以及文中陈述文字和内容未经本站证实,对本文以及其中全部或者部分内容文字的真实性、完整性和原创性本站不作任何保证或承诺,请读者仅作参考,并自行核实相关内容。文章投诉邮箱:anhduc.ph@yahoo.com

    分享
    投诉
    首页