繁体   English   中英

使用Ksoap2从android中的webservice获取Respose Header

[英]getting Respose Header from webservice in android using Ksoap2

我的web服务在.net中,我已经在android中使用KSOAP2成功从Soap Response获取数据。 我想从头部获取响应头和一些细节,任何人都可以帮助如何使用KSOAP2获取响应头?

>   The HttpTransportSE class exposes the method call that, beyond the
> required SOAP    parameters, also accepts a List of HeaderProperty
> instances. It also returns a like List. This provides the ability to
> append additional headers to the request and review the returned
> headers. Since a cookie is just one of those header, one can use this
> facility to send and receive cookies.

The response headers are returned by the "call" method. So you just need to keep track of your JSESSIONID and pass it back again for each call. I overlooked this small detail at first as well. ;)

Keep in mind that the server returns the JSESSIONID with a "set-cookie" header, but it needs to be sent with a "cookie" header.

List respHeaders = android_http.call(SOAP_ACTION, envelope2, reqHeaders); 
for(int ix=0; ix<respHeaders.size(); ix++) { 
        HeaderProperty hp = (HeaderProperty)respHeaders.get(ix); 
        System.out.println("Header"+ix+"="+hp.getKey()+" / "+hp.getValue()); 
} 

暂无
暂无

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

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