2009-11-19 57 views
0

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

在哪里我应该得到一个(非契约)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. 

离.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. 

回答

0

<详细信息>不符合SOAP12标准(它没有名称空间),服务必须通过SOAP11端点消耗。

+0

如果我无法控制服务器,该怎么办? – 2010-08-23 07:40:57

+0

@Summer - 然后更改客户端使用并期待Soap11。 – 2014-10-29 18:33:57