webservice登录前设置cookieContainer问题
永生天地 2010-01-21 12:51:21 我需要访问的webservice,首先需要进行登录login(username,password)
这个没问题,返回值正确。可以在log文件中看到,见后面的log
可是,文档上明确指出:登录前必须实例化 cookieContainer
WebService.WebServiceCore core = new WebService.WebServiceCore();
core.CookieContainer = new System.Net.CookieContainer();
在pb里怎么能把上面的方法实现呢,否则,其他的函数返回都是有问题的
日志记录:
<?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><soap:Body><GetTknResponse xmlns="http://tempuri.org/"><GetTknResult /></GetTknResponse></soap:Body></soap:Envelope>Connection Cached
CLOSED
REQUEST:
CLOSED
POST /ws403/webservicecore.asmx HTTP/1.1
Host: edoc2.dalianhonour.com:8081
Connection: Keep-Alive
User-Agent: EasySoap++/0.6
Content-Type: text/xml; charset=utf-8
SOAPAction: "http://tempuri.org/Login"
Content-Length: 483
<E:Envelope
xmlns:E="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:A="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:s="http://www.w3.org/2001/XMLSchema-instance"
xmlns:y="http://www.w3.org/2001/XMLSchema"
E:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<E:Body>
<m:Login
xmlns:m="http://tempuri.org/">
<m:userName
s:type="y:string">username</m:userName>
<m:password
s:type="y:string">password</m:password>
</m:Login>
</E:Body>
</E:Envelope>
RESPONSE:
HTTP/1.1 200 OK
Date: Wed, 20 Jan 2010 16:52:17 GMT
Server: Microsoft-IIS/6.0
X-Powered-By: ASP.NET
X-AspNet-Version: 2.0.50727
Set-Cookie: ASP.NET_SessionId=k1jf3t45ietasa45vltgwm55; path=/; HttpOnly
Set-Cookie: tkn=1a6691fd-ed9b-4609-8de0-37d8b8a33b8c; path=/
Set-Cookie: jueLng=zh-cn; path=/
Set-Cookie: jueTheme=Asia/Shanghai; path=/
Cache-Control: private, max-age=0
Content-Type: text/xml; charset=utf-8
Content-Length: 333
服务器的响应里有几个set-cookie,谁能给解释一下这个在pb里怎么用