WCF - ASMX - CommunicationException

时间:2009-11-19 17:59:06

标签: xml soap exception-handling asmx wcf-client

所以我有一个使用ASMX网络服务的WCF客户端。一切正常,除了异常处理。

我应该得到一个(非合同的)FaultException,我得到了CommunicationException。

可能有什么问题?


以下是相关数据:

SOAP响应(似乎是根据规范):

<?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><soap:Body><soap:Fault><soap:Code><soap:Value>soap:Sender</soap:Value></soap:Code><soap:Reason><soap:Text xml:lang="en">User not found or password is incorrect (User not found)</soap:Text></soap:Reason><soap:Node>Login</soap:Node><detail><ErrorInfo xmlns="http://tempuri.org/"><Area>Security</Area><ErrorCode>1</ErrorCode><Message>User not found or password is incorrect (User not found)</Message></ErrorInfo></detail></soap:Fault></soap:Body></soap:Envelope>

ex.Message(CommunicationException):

Server returned an invalid SOAP Fault.  Please see InnerException for more details.

ex.InnerException.Message(XmlException):

End element 'Fault' from namespace 'http://www.w3.org/2003/05/soap-envelope' expected. Found element 'detail' from namespace ''. Line 1, position 444.

1 个答案:

答案 0 :(得分:0)

&lt;细节&gt;不符合SOAP12标准(它没有命名空间),必须通过SOAP11端点使用该服务。