有誰知道Fiddler是否可以顯示ASMX Web服務的原始SOAP消息?我正在使用Fiddler2和Storm測試一個簡單的Web服務,結果各不相同(Fiddler顯示純XML而Storm顯示SOAP消息)。見樣品請求/下面的反應:如何使用Fiddler2查看ASMX SOAP?
Fiddler2請求:
POST /webservice1.asmx/Test HTTP/1.1
Accept: */*
Referer: http://localhost.:4164/webservice1.asmx?op=Test
Accept-Language: en-us
User-Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.04506.30; .NET CLR 3.0.04506.648; .NET CLR 3.5.21022; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729; InfoPath.2; MS-RTC LM 8)
Content-Type: application/x-www-form-urlencoded
Accept-Encoding: gzip, deflate
Host: localhost.:4164
Content-Length: 0
Connection: Keep-Alive
Pragma: no-cache
Fiddler2響應:
HTTP/1.1 200 OK
Server: ASP.NET Development Server/9.0.0.0
Date: Thu, 21 Jan 2010 14:21:50 GMT
X-AspNet-Version: 2.0.50727
Cache-Control: private, max-age=0
Content-Type: text/xml; charset=utf-8
Content-Length: 96
Connection: Close
<?xml version="1.0" encoding="utf-8"?>
<string xmlns="http://tempuri.org/">Hello World</string>
風暴請求(僅機身):
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<Test xmlns="http://tempuri.org/" />
</soap:Body>
</soap:Envelope>
風暴答覆:
Status Code: 200
Content Length : 339
Content Type: text/xml; charset=utf-8
Server: ASP.NET Development Server/9.0.0.0
Status Description: OK
<?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>
<TestResponse xmlns="http://tempuri.org/">
<TestResult>Hello World</TestResult>
</TestResponse>
</soap:Body>
</soap:Envelope>
感謝您的幫助。
謝謝約翰。由於SOAP只是XML,因此通過電線發送的「原始」SOAP消息應該是Storm所示的請求/響應消息中顯示的XML。似乎Fiddler正在剝離它,我沒有想到。我已經看到Fiddler顯示WCF服務的實際肥皂,所以不知道爲什麼ASMX服務會有什麼不同... – 2010-01-29 14:06:39
Fiddler沒有剝離任何東西,我向你保證。你沒有看到SOAP,因爲它不在那裏。您使用測試表單發布消息,該消息不使用SOAP! – 2010-01-29 16:50:42