calling a session based web service using ksoap2
My webservice uses soapsession as the session mechanism. I want to call that web service using ksoap2 api. How can I call that web service so that session will be maintained? ya, one more question. Now the web service is not returning the ServiceGroupId to the client written in ksoap2 api unlike it sends the same when I write the client using the a开发者_StackOverflow社区xis2 api (ServiceClient). This is because in ksoap2 client, I am not engaging the addressing module. So, my question is Can I engage the addressing module using ksoap2 ?
You can use a KeepAliveHttpsTransportSE, but you can only use this one connection then. Else you need to get the sessionID from your auth call.
When you have made the auth call with your HttpsTransportSE transport use this:
List<HeaderProperty> hp = (List<HeaderProperty>)transport.getConnection().getResponseProperties();
for (int i = 0; i < hp.size(); i++) {
if (hp.get(i).getKey().equals("set-cookie")){
SESSION_ID = hp.get(i).getValue();
break;
}
}
And set the sessionID into the header when you make a new WebService Call.
精彩评论