0

所以我有一个使用 ASMX Web 服务的 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.
4

1 回答 1

0

<detail> 不符合 SOAP12 标准(它没有命名空间),必须通过 SOAP11 端点使用服务。

于 2009-11-20T13:09:52.923 回答