【发布时间】:2016-01-09 01:37:59
【问题描述】:
我使用由 axis2 创建的 adb-stubs 访问 SOAP 服务,我应该从响应中获取 sessionId 和 cookie,然后使用另一个请求发送...
我需要获取您可以在图片中看到的这些参数
http://www.imageup.ru/img36/1635686/skrinshot-2014-01-23-104646.png
MessageContext msgCtx = serviceStub._getServiceClient().getLastOperationContext().getMessageContext(WSDLConstants.MESSAGE_LABEL_IN_VALUE);
msgCtx.getProperty(HTTPConstants.HTTP_HEADERS);
SOAPHeader soapHeader = msgCtx.getEnvelope().getHeader();
我试过这些,但我能得到结果:( 我还将 manageSession 参数设置为 true。
当我调试请求和响应时,我得到以下日志:
2014/01/23 12:35:55:372 ALMT [DEBUG] header - << "HTTP/1.1 200 OK[\r][\n]"
2014/01/23 12:35:55:372 ALMT [DEBUG] header - << "HTTP/1.1 200 OK[\r][\n]"
2014/01/23 12:35:55:372 ALMT [DEBUG] header - << "Cache-Control: private, max-age=0[\r][\n]"
2014/01/23 12:35:55:372 ALMT [DEBUG] header - << "Content-Length: 505[\r][\n]"
2014/01/23 12:35:55:372 ALMT [DEBUG] header - << "Content-Type: text/xml; charset=utf-8[\r][\n]"
2014/01/23 12:35:55:372 ALMT [DEBUG] header - << "Server: Microsoft-IIS/7.5[\r][\n]"
2014/01/23 12:35:55:382 ALMT [DEBUG] header - << "X-AspNet-Version: 2.0.50727[\r][\n]"
2014/01/23 12:35:55:382 ALMT [DEBUG] header - << "Set-Cookie: ASP.NET_SessionId=agj1njnpvoerup45tqnmsz45; path=/; HttpOnly[\r][\n]"
2014/01/23 12:35:55:382 ALMT [DEBUG] header - << "X-Powered-By: ASP.NET[\r][\n]"
2014/01/23 12:35:55:382 ALMT [DEBUG] header - << "Date: Thu, 23 Jan 2014 06:35:59 GMT[\r][\n]"
2014/01/23 12:35:55:382 ALMT [DEBUG] header - << "[\r][\n]"
2014/01/23 12:35:55:382 ALMT [DEBUG] CookieSpec - Unrecognized cookie attribute: name=HttpOnly, value=null
2014/01/23 12:35:55:382 ALMT [DEBUG] HttpMethodBase - Cookie accepted: "$Version=0; ASP.NET_SessionId=agj1njnpvoerup45tqnmsz45; $Path=/"
请帮帮我。
【问题讨论】: