webservice框架_webservice篇1 ABAP调用webservice

在ABAP中调用Webservice

一. 创建Webservice

    有两种方式创建webservice,一种是在se80中使用wizard生成,另一种是直接在se37中给予function生成,具体操作如下:

    1.se80中Create-->Enterprise Service/Web Service --> Web Servcie

      维护service名,选择一个poit type(type point为一个功能点:如,Bapi中的Method,FunctionGroup中的一个function,一个function或者Message Interface:XI)

    2.se37 Utility--> More Utility --> Create WebService -->From the Function Module

    在创建完成的时候可以选择立刻release,否则需要在wsconfig中进行release。

二 WSASMIN(WebService Administration)

     Tcode:wsadmin

    选中刚刚创建的Webservice ,可以有两种操作测试webservice

   1.点击Ctrl+F8 --> 进入WebService HomePage(可以预览webservice发送接收的数据)

    2.点击Ctrl+F1 --> 预览WSDL文档

三 在Wsconfig中设置Logon Data

    输入Service Definition , 并填写一个Variant,点击新建

   Create --> ICF Detail -->在Servcie列表中选择需要设置Logo Data的Service,双击,在logon data的tab页中设置logo data(设置了logon data的service在调用时就不会在弹出logon对话框)

    (tcode :SICF 可以直接进入Maintain Service)

四 在ABAP中调用Webservice

    1.创建Proxy

     se80 --> Create --> Enterprice Service --> Proxy

    在Proxy中指定wsdl连接

    2. 创建Logical Port (tcode:lpconfig)

    输入Logical Port,指定Proxy Class,点击新建。

    3.创建程序

      在se80中,将Proxy拖入到workbench中,自动生成代码框架,根据自己需求进行简单的修改,代码示例如下:

DATA: g_proxy TYPE REF TO zglco_zgl_flight .TRY.CREATE OBJECT g_proxyEXPORTING logical_port_name = 'ZGLPORT_FLIGHT'
         .CATCH cx_ai_system_fault .ENDTRY.
DATA: output TYPE zglflight_get_list_response .DATA: input TYPE zglflight_get_list .input-max_rows = 10 .TRY.CALL METHOD g_proxy->flight_get_listEXPORTINGinput   = inputIMPORTINGoutput = output.CATCH cx_ai_system_fault .CATCH cx_ai_application_fault .ENDTRY.DATA : ls_sflight TYPE zglbapisfldat.DATA : lt_sflight TYPE zglbapisfldat_tab .
lt_sflight = output-flight_list-item .LOOP AT lt_sflight INTO ls_sflight .WRITE    : ls_sflight-airlineid , ls_sflight-airline ,
             ls_sflight-connectid , ls_sflight-flightdate ,
             ls_sflight-airportfr , ls_sflight-cityfrom ,
             ls_sflight-airportto , ls_sflight-cityto ,
             ls_sflight-deptime ,    ls_sflight-arrtime ,
             ls_sflight-arrdate ,    ls_sflight-price ,
             ls_sflight-curr ,       ls_sflight-curr_iso .ULINE .ENDLOOP.

详细步骤:

  1. SE80 创建企业服务 

    647568e2c91c54aa1a7c6ffb15c80f51.png

30f724da415d2cb9ed9a1d2d3c32ad0c.png

7d4f7961cf56d0642dea1c912c085624.png

206841ed6aa2e17e9598aee86ae45ba9.png

填入链接

89c64e1128a364df012a4e49c54f126b.png

79b7aa90b229c87847441c020b183e57.png

d30ebf7ba8e9e137a0e6b52e59846a5b.png

出现了问题

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值