-->

ksoap session web service

2019-05-29 21:24发布

问题:

How can i maintain the session state using ksoap? I need a way to receive and send the unique SessionID from the asp.net web service.

So i wrote a simple web service, but the result is always 1....

[ScriptMethod]
[WebMethod(EnableSession = true)]
public string Calculate()
{
    if (Session["example"] == null) { Session["example"] = 0; }
    int r = Convert.ToInt32(Session["example"]);
    r = r + 1;
    Session["example"] = r;
    return Session["example"].ToString();   
}

I know that i somehow need to get the SessionID from the cookie send back from the server, and use it on every new call to the service, but dont know how to do it. Im making the call from an Android application