2011-07-11 39 views
2

我正在使用wsHttpBinding與WCF服務。wsHttpBinding在客戶端上的wcf服務和Web引用不起作用

我已經添加了一個Web引用,並且我已經獲得了Web代理(它基於SoapHttpClientProtocol)。

另外我試過使用wsdl.exe和wcf服務生成的實際wsdl(http://zzzz/zz.svc?wsdl)來構建代理。

當客戶端調用服務,我得到以下錯誤:

The SOAP action specified on the message, '', does not match the HTTP SOAP Action, 'http://tempuri.org/Service1/Operation1'.

爲什麼沒有客戶端(Web代理)與我的WCF服務工作?

我應該採取哪些措施來使它們工作?

我正在運行.NET FW 3.5和ASP.NET 2.0。

+0

您可以檢查您的WSDL SOAPACTION地址 – sandyiit

+0

這裏是我的WSDL: ... Max

+0

definitioins是: xmlns:wsa =「http:// schema s.xmlsoap.org/ws/2004/08/addressing「xmlns:wsp =」http://schemas.xmlsoap.org/ws/2004/09/policy「xmlns:wsap =」http://schemas.xmlsoap。 org/ws/2004/08/addressing/policy「 xmlns:xsd =」http://www.w3.org/2001/XMLSchema「xmlns:msc =」http://schemas.microsoft.com/ws/2005/12/wsdl/contract「xmlns:wsaw =」http://www.w3.org/2006/05/addressing/wsdl「xmlns:soap12 =」http://schemas.xmlsoap.org/wsdl/soap12/「 xmlns:wsa10 =「http://www.w3.org/2005/08/addressing」xmlns:wsx =「http://schemas.xmlsoap.org/ws/2004/09/mex」 策略: Max

回答

6

您不能使用wsHttpBinding上顯示的服務,並使用舊ASMX代理的默認配置。您必須使用添加服務參考/svcutil或將您的綁定更改爲basicHttpBindingwsHttpBinding的默認配置使用高級安全性,ASMX不支持它。

+0

非常感謝您的快速和一致的答案!希望它可以幫助任何犯了同樣錯誤的人... – Max

+0

我已經更改了對basicHttpBinding的綁定,但現在我得到以下內容: System.Net.WebException:請求失敗,HTTP狀態爲415:無法處理消息,因爲內容鍵入'application/soap + xml;字符集= UTF-8; action =「http://tempuri.org/IService1/Operation1」'不是預期的類型'text/xml;字符集= UTF-8' 。我使用SOAPUI 4.0來測試服務。 WCFTestClient可以正常使用該服務,但ASMX代理不會。但我需要使用web(ASMX)代理... – Max

+0

它說你在SOAP 1.2中傳遞請求,但服務只接受SOAP 1.1。 –