当前位置: 代码迷 >> Web Service >> gsoap下用session的有关问题。
  详细解决方案

gsoap下用session的有关问题。

热度:299   发布时间:2012-04-08 14:38:30.0
gsoap下用session的问题。。。
服务端http://125.46.50.200/enatt/coreservices.asmx,想用gsoap实现session。。。。。没办法。。。。

------解决方案--------------------
19.28 Client-Side Cookie Support

Client-side cookie support is optional. To enable cookie support, compile all sources with option -DWITH_COOKIES, for example: 

> c++ -DWITH_COOKIES -o myclient stdsoap2.cpp soapC.cpp soapClient.cpp

or add the following line to stdsoap.h: 

#define WITH_COOKIES

Client-side cookie support is fully automatic. So just (re)compile stdsoap2.cpp with -DWITH_COOKIES to enable cookie-based session control in your client.
A database of cookies is kept and returned to the appropriate servers. Cookies are not automatically saved to a file by a client. An example cookie file manager is included as an extras in the distribution. You should explicitly remove all cookies before terminating a gSOAP context by calling soap_free_cookies(soap) or by calling soap_done(soap).
To avoid "cookie storms" caused by malicious servers that return an unreasonable amount of cookies, gSOAP clients/servers are restricted to a database size that the user can limit (32 cookies by default), for example: 

struct soap soap; 
soap_init(&soap); 
soap.cookie_max = 10;
  相关解决方案