3

私のWebサービスは.netにあり、AndroidでKSOAP2を使用してSoap Responseからデータを正常に取得しました。応答ヘッダーとヘッダーから詳細を取得したいのですが、KSOAP2 を使用して応答ヘッダーを取得する方法を教えてください。

4

1 に答える 1

1
>   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()); 
} 
于 2012-10-11T05:55:32.890 に答える