我正在做研究,我下載了一個測試應用程序,調用標準的.asmx服務。該服務正在使用標準的POST請求進行調用。 Im有點困惑,因爲我認爲.asmx服務總是使用SOAP?或者是與最近推出的HTTP(POST)進行通信的能力?.net 2.0 web服務是否總是使用soap over soap?
3
A
回答
1
.NET Web-Services使用您選擇的一種協議。由default它是SOAP
,和POST
請求被允許。
斯坦達特的幫助頁面:
POST /demo/MSDN/PerfCounter.asmx HTTP/1.1
Connection: Keep-Alive
Content-Length: 150
Content-Type: text/xml
Host: localhost
User-Agent: MS Web Services Client Protocol 1.0.2204.19
SOAPAction: "http://tempuri.org/PerfCounters"
<?xml version="1.0"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/1999/XMLSchema">
<soap:Body>
<PerfCounters xmlns="http://tempuri.org/"/>
</soap:Body>
</soap:Envelope>
您也可以啓用GET
方法:
<configuration>
<system.web>
<webServices>
<protocols>
<add name="HttpGet"/>
<add name="HttpPost"/>
</protocols>
</webServices>
</system.web>
</configuration>
這個工作從.NET 1.1
0
SOAP是您可以選擇使用的標準。它基於XML。如果它是簡單的,比我會使用JSON。 Web服務不限於POST。運行創建/更新/刪除例程時應使用POST,並且在運行數據檢索例程時應使用GET。
1
不,ASMX web服務不限於SOAP。您可以使用ScriptMethodAttribute爲web方法指定HTTP謂詞。這是在.NET 3.5中引入的。例如:
[ScriptMethod(UseHttpGet = true)]
public string MyMethod()
{
return "Hello World";
}
相關問題
- 1. 是否可以使用.net核心編寫soap web服務?
- 2. .NET Web服務 - SOAP錯誤
- 3. 使用SOAP Web服務
- 4. 使用SOAP的Web服務
- 5. 使用SOAP Web服務
- 6. Android Web服務,REST還是SOAP WSDL?
- 7. Android Web服務SOAP
- 8. iPhone Soap Web服務
- 9. SOAP Web服務UI
- 10. 從SOAP Web服務
- 11. Android SOAP Web服務
- 12. 使用Retrofit進行SOAP web服務調用是可能的嗎?
- 13. .NET SOAP Web服務序列化錯誤
- 14. iPhone XML SOAP請求或.NET Web服務
- 15. PHP - Zend SOAP請求.NET SOAP服務器
- 16. 在RoR中使用SOAP Web服務
- 17. PHP SOAP web服務調用
- 18. Spring Web服務和SOAP
- 19. 使用WS-Security使用SOAP Web服務
- 20. erlang中的SOAP web服務
- 21. 使用ksoap2 lib的SOAP web服務
- 22. iPhone和SOAP Web服務
- 23. 使用Perl和SOAP Lite來使用.Net Web服務
- 24. 使用Soapclient調用soap web服務
- 25. 在BlackBerry PlayBook上使用.net SOAP服務
- 26. 基於SOAP的WCF服務操作是否使用Soap Envelope自動序列化?
- 27. SugarCRM over SOAP - V2
- 28. USI Web服務SOAP格式
- 29. 使用SOAP消費Web服務
- 30. 在java中使用SOAP web服務