开发者

calling a session based web service using ksoap2

开发者 https://www.devze.com 2023-04-04 09:13 出处:网络
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. No

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号