【问题标题】:SOAP. JAX-WS. Authorization肥皂。 JAX-WS。授权
【发布时间】:2020-11-11 11:32:48
【问题描述】:
  1. 所以,我已通过 -wsimport 将 WSDL 解析到我的项目中。
  2. 然后,我初始化它们
  3. 提出了一些要求

soapServicePortType = 接口,其中是 WSDL 的方法。 getHouseCall = 获取信息的方法

  1. 但我应该授权

  2. 正如我在堆栈跟踪中看到的,由 HttpTransportPipe 类构建消息。在这个类中,我找到了方法“addBasicAuth”,当我可以插入登录并通过时。

所以,我有两个问题:

  1. 如何让我的请求在构建请求时使用“addBasicAuth”方法
  2. 如何添加一个header(coockie)?

【问题讨论】:

    标签: java soap authorization testng jax-ws


    【解决方案1】:

    我这样解决了:

    ((BindingProvider) /*Insert InterfaceClass of port WSDL*/).getRequestContext().put(BindingProvider.USERNAME_PROPERTY, "login");
    ((BindingProvider) /*Insert InterfaceClass of port WSDL*/).getRequestContext().put(BindingProvider.PASSWORD_PROPERTY, "password");
    

    而且不需要发送饼干

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-11-10
      • 1970-01-01
      • 1970-01-01
      • 2012-07-18
      相关资源
      最近更新 更多