简体   繁体   English

肥皂。 JAX-WS。 授权

[英]SOAP. JAX-WS. Authorization

  1. So, i have parsed WSDL by -wsimport to my project.所以,我已经通过 -wsimport 将 WSDL 解析到我的项目中。
  2. Then, i initialize them然后,我初始化它们
  3. Did some request做了一些请求

soapServicePortType = Interface, where is methods of WSDL. soapServicePortType = Interface,其中是WSDL 的方法。 getHouseCall = GETmethod of info getHouseCall = GET 信息的方法

屏幕

  1. But i should authorizate但我应该授权

  2. As i see in stacktrace, message building by HttpTransportPipe class.正如我在堆栈跟踪中看到的,通过 HttpTransportPipe 类构建消息。 In this class i found method "addBasicAuth", when i can insert Login and pass.在这个类中,我找到了方法“addBasicAuth”,当我可以插入登录并通过时。

So, i have 2 questions:所以,我有两个问题:

  1. How to make my request use "addBasicAuth" method when it building request构建请求时如何使我的请求使用“addBasicAuth”方法
  2. How to add one header (coockie) to it?如何向其中添加一个标题(coockie)?

I solved it so:我是这样解决的:

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

And no need to sending coockies并且无需发送cookies

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM