调用Web Service 并进行页面跳转(一)

使用Web Service获取Token并实现页面跳转
本文档展示了如何在ABAP中调用Web Service获取Token,并结合JavaScript进行页面跳转。通过创建对象、调用服务方法,然后处理响应,最终利用JavaScript改变页面URL实现跳转。

 <%@page language="abap" %>
<%@extension name="htmlb" prefix="htmlb" %>
<htmlb:content design="design2003" >
  <htmlb:page title="SSO test " >
    <htmlb:form>
      <%
  DATA: lo_clientproxy TYPE REF TO zssopreco_sso_web_service_port,
  lo_sys_exception TYPE REF TO cx_ai_system_fault,
  ls_request_token TYPE zssopreget_token_request,
  ls_response_token TYPE zssopreget_token_response,
  ls_request_hello TYPE zssopresay_hello_request,
  ls_response_hello TYPE zssopresay_hello_response,
  lv_url TYPE string.
  CREATE OBJECT lo_clientproxy.
  BREAK con-zhaocf.
  ls_request_token-in0 = 'CRM'.
  ls_request_token-in1 = sy-uname.
  ls_request_token-in2 = 'SOLAR'.
  TRY.
  TRY.
  CALL METHOD lo_clientproxy->get_token
  EXPORTING
  get_token_request  = ls_request_token
  IMPORTING
  get_token_response = ls_response_token.
  CATCH cx_ai_system_fault INTO lo_sys_exception.
  WRITE: / lo_sys_exception->errortext.
  CATCH cx_ai_application_fault .
  ENDTRY.
  ENDTRY.
  CLEAR: lv_url.
  CONCATENATE 'http://10.100.93.113:8080/lenovo-ovp-web/SsoRedirectServlet?token=' ls_response_token-out-token INTO lv_url.
      %>
      <htmlb:inputField id       = "SOLAR"
                        required = "true"
                        visible  = " "
                        value    = "<%= lv_url %>" />
      <script language="javascript" type="text/javascript">
      var jsurl = window.document.getElementById('SOLAR').value;
      window.location.href=jsurl;
      </script>
    </htmlb:form>
  </htmlb:page>
</htmlb:content>

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值