Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/223.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 使用Ksoap2从android中的webservice获取响应头_Java_Android_Android Ksoap2 - Fatal编程技术网

Java 使用Ksoap2从android中的webservice获取响应头

Java 使用Ksoap2从android中的webservice获取响应头,java,android,android-ksoap2,Java,Android,Android Ksoap2,我的Web服务在.net中,我已经在android中使用KSOAP2成功地从Soap响应获取数据。我想从标题中获取响应标题和一些详细信息,有人能帮助我如何使用KSOAP2获取响应标题吗?>HttpTransportSE类公开了方法调用,该方法调用超出了 > The HttpTransportSE class exposes the method call that, beyond the > required SOAP parameters, also accepts a

我的Web服务在.net中,我已经在android中使用KSOAP2成功地从Soap响应获取数据。我想从标题中获取响应标题和一些详细信息,有人能帮助我如何使用KSOAP2获取响应标题吗?

>HttpTransportSE类公开了方法调用,该方法调用超出了
>   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()); 
} 
>必需的SOAP参数,还接受HeaderProperty的列表 >实例。它还返回一个like列表。这就提供了 >向请求附加附加头并查看返回的 >标题。因为cookie只是其中的一个标头,所以可以使用它 >发送和接收cookie的工具。 响应头由“call”方法返回。因此,您只需要跟踪您的JSESSIONID,并在每次调用时再次将其传递回。起初我也忽略了这个小细节 请记住,服务器返回带有“set cookie”头的JSSessionID,但需要发送带有“cookie”头的JSSessionID。 List respHeaders=android_http.call(SOAP_操作、信封2、reqHeaders);
对于(int ix=0;ixShyam,感谢您的回复,但在调用Webservice 1ef9fd6a-da32-48cc-af3e-45952F471D62True的登录方法后,我在web浏览器上获得了以下信息?调用方法中的第三个参数是什么?如果probelem使用KSOAP2连接到android中的服务器,如何获取响应中的状态代码?