A problem w/ ATL web server - URGENT !!!
-
Hi all, I have really big problem w/ my web servervice. I implemented the web server w/ ATL, so now I have a Cws ATL class that implements the web service and a CwsIsapi that implements the ISAPI extension. Then I am consuming this web service in C#. /////////////////////// ATL WEB SERVER /////////////////////////
class Cws { [soap_method] HRESULT init (/*[in]*/ int num) { m_mem = num; return S_OK; }; [soap_method] HRESULT get_number (/*[out]*/ int *val) { *val = num; return S_OK; } protected: int m_mem; };
/////////////////////////////// C# CONSUMER ///////////////////////////////////////////... mymachine.Cws service = new mymachine.Cws (); service.init (3); int val; service.get_number (out val); if (val != 3) { //error: THIS ALWAIS HAPPEN } ...
This code DOES NOT WORK !!! In fact when "service.get_number (out val)" is invoked, an instance of Cws is created then destroyed, so when "service.get_number (out val)" is invoked, the instance is different and m_mem is not initialized to 3 any more !!! Is there any way in order to change this behaviour? Any help will be appreciated. Thanx very much. Regards, Andrea -
Hi all, I have really big problem w/ my web servervice. I implemented the web server w/ ATL, so now I have a Cws ATL class that implements the web service and a CwsIsapi that implements the ISAPI extension. Then I am consuming this web service in C#. /////////////////////// ATL WEB SERVER /////////////////////////
class Cws { [soap_method] HRESULT init (/*[in]*/ int num) { m_mem = num; return S_OK; }; [soap_method] HRESULT get_number (/*[out]*/ int *val) { *val = num; return S_OK; } protected: int m_mem; };
/////////////////////////////// C# CONSUMER ///////////////////////////////////////////... mymachine.Cws service = new mymachine.Cws (); service.init (3); int val; service.get_number (out val); if (val != 3) { //error: THIS ALWAIS HAPPEN } ...
This code DOES NOT WORK !!! In fact when "service.get_number (out val)" is invoked, an instance of Cws is created then destroyed, so when "service.get_number (out val)" is invoked, the instance is different and m_mem is not initialized to 3 any more !!! Is there any way in order to change this behaviour? Any help will be appreciated. Thanx very much. Regards, AndreaWeb services are a stateless RPC protocol. After the call is finished the instance is destroyed. There is a way to enable session state in web services but I don't know how to do it in ATL. Information on How To Enable session state in a C# Web service is located at the following link. http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconstatemanagementinaspnetwebservices.asp Best of luck Forever Developing