這是對我發佈的問題Android accesing soap service的跟進。經過大量的調試和使用wireshark,我意識到這是發送的內容。從android獲取肥皂服務
POST /GetGoldPrice.asmx HTTP/1.1
user-agent: kSOAP/2.0
soapaction: http://freewebservicesx.com/GetCurrentGoldPrice
content-type: text/xml
connection: close
content-length: 475
Host: www.freewebservicesx.com
<v:Envelope xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns:d="http://www.w3.org/2001/XMLSchema" xmlns:c="http://schemas.xmlsoap.org/soap/encoding/" xmlns:v="http://schemas.xmlsoap.org/soap/envelope/"><v:Header /><v:Body>
<GetCurrentGoldPrice xmlns="http://www.freewebservicesx.com/" id="o0" c:root="1">
<UserName i:type="d:string">username</UserName>
<Password i:type="d:string">111</Password></GetCurrentGoldPrice></v:Body></v:Envelope>
HTTP/1.1 500 Internal Server Error
Connection: close
Date: Mon, 09 Apr 2012 04:38:50 GMT
Server: Microsoft-IIS/6.0
X-Powered-By: ASP.NET
X-AspNet-Version: 2.0.50727
Cache-Control: private
Content-Type: text/xml; charset=utf-8
Content-Length: 753
錯誤響應的網站所期待的
<?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><soap:Fault><faultcode>soap:Server</faultcode>
<faultstring>System.Web.Services.Protocols.SoapException: Server was unable to process request. ---> System.ArgumentNullException: Value cannot be null.
Parameter name: password
at System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(String password, String passwordFormat)
at GetGoldPrice.GetCurrentGoldPrice(String UserName, String Password)
--- End of inner exception stack trace ---</faultstring><detail /></soap:Fault></soap:Body></soap:Envelope>
詳細信息。
http://www.freewebservicesx.com/GetGoldPrice.asmx?op=GetCurrentGoldPrice
添加到
web.config
文件已經更新的問題。同樣的錯誤仍然被拋出 – user1092042 2012-04-09 04:49:16我已經更新了我的回答與請求的格式,以使Web服務返回一個有效的XML響應。你可以檢查從Android產生相同的? – AYK 2012-04-09 05:04:39
以上代碼由android生成併發布。看起來我的密碼在到達服務器時變爲空,但從我的機器發送得很好。任何想法,爲什麼在世界上這個SIS發生 – user1092042 2012-04-09 05:44:45