首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > Web Service >

gsoap下用session的有关问题。

2012-04-08 
gsoap下用session的问题。。。服务端http://125.46.50.200/enatt/coreservices.asmx,想用gsoap实现session。。。

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;

热点排行