Android ksoap会话web服务

Android ksoap会话web服务,android,android-ksoap2,Android,Android Ksoap2,如何使用ksoap维护会话状态?我需要一种从asp.net web服务接收和发送唯一SessionID的方法 所以我写了一个简单的web服务,但结果总是1 [ScriptMethod] [WebMethod(EnableSession = true)] public string Calculate() { if (Session["example"] == null) { Session["example"] = 0; } int r = Convert.ToInt32(Ses

如何使用ksoap维护会话状态?我需要一种从asp.net web服务接收和发送唯一SessionID的方法

所以我写了一个简单的web服务,但结果总是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();   
}
我知道我不知何故需要从服务器发送回的cookie中获取SessionID,并在每次新的服务调用中使用它,但我不知道如何做到这一点。我是通过安卓应用程序打电话的