主题:WebService的session问题:一个connector能否连续调用WebService?
我在服务端定义了Login、WebMethod1、WebMethod2……。
客户端调用WebMethod1、WebMethod2……之前要先调用Login进行登陆校验,若登陆校验成功,在Login中置Session["Login"]=true,否则置Session["Login"]=false。
然后其他的WebMethod中都检查Session["Login"],这样实现一次登录后持续使用WebService。
我在Web浏览器中测试都没问题。
现在我用VC++6.0客户端调用Login实现登陆后再调用其他WebService,发现都新开一个session,相当于新开一个浏览器进程,前面的session消失了!
VC中使用SOAP每次调用WebService的大致过程是:
Connector.CreateInstance(__uuidof(HttpConnector30));
Connector->Property["EndPointURL"] = "http://localhost/WebServiceTest2/Service.asmx";
Connector->Connect();
Connector->Property["SoapAction"] = "http://Fantasy/WebServiceTest2/Hello1";
Connector->BeginMessage();
Serializer.CreateInstance(__uuidof(SoapSerializer30));
Serializer->Init(_variant_t((IUnknown*)Connector->InputStream));
Serializer->StartEnvelope("","","");
现在的问题是如何保持一个Connector,使VC中所有的WebService调用都在一次Session中完成呢?
有没用遇到过这方面问题的同仁,希望指点一二,谢谢~
客户端调用WebMethod1、WebMethod2……之前要先调用Login进行登陆校验,若登陆校验成功,在Login中置Session["Login"]=true,否则置Session["Login"]=false。
然后其他的WebMethod中都检查Session["Login"],这样实现一次登录后持续使用WebService。
我在Web浏览器中测试都没问题。
现在我用VC++6.0客户端调用Login实现登陆后再调用其他WebService,发现都新开一个session,相当于新开一个浏览器进程,前面的session消失了!
VC中使用SOAP每次调用WebService的大致过程是:
Connector.CreateInstance(__uuidof(HttpConnector30));
Connector->Property["EndPointURL"] = "http://localhost/WebServiceTest2/Service.asmx";
Connector->Connect();
Connector->Property["SoapAction"] = "http://Fantasy/WebServiceTest2/Hello1";
Connector->BeginMessage();
Serializer.CreateInstance(__uuidof(SoapSerializer30));
Serializer->Init(_variant_t((IUnknown*)Connector->InputStream));
Serializer->StartEnvelope("","","");
现在的问题是如何保持一个Connector,使VC中所有的WebService调用都在一次Session中完成呢?
有没用遇到过这方面问题的同仁,希望指点一二,谢谢~