WCF客户端从第三方使用SOAP服务(Java实现)。 WSDL通过添加服务引用生成代理。 4.5框架。
通过AfterReceiveReply拦截的消息,.ToString()如下: -
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Header xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:wsa="http://www.w3.org/2005/08/addressing" xmlns:v1="http://group.customer.com/contract/vbo/header/v1">
<v1:Destination>
<!--Optional:-->
<v1:CountryCode>USA</v1:CountryCode>
<!--Optional:-->
<v1:LanguageCode>eng</v1:LanguageCode>
<!--Optional:-->
<v1:Operator>customer</v1:Operator>
<!--Optional:-->
<v1:Division>CustomerManagement</v1:Division>
<!--Optional:-->
<v1:System>CRM</v1:System>
<!--Optional:-->
<v1:Timestamp>2015-03-30T09:30:10Z</v1:Timestamp>
</v1:Destination>
<v1:Cache>
<v1:UseCache>yes</v1:UseCache>
<v1:MaxAge>86400000</v1:MaxAge>
<v1:LastModified>2014-05-30T09:30:10Z</v1:LastModified>
</v1:Cache>
<v1:Correlation>
<v1:ConversationID>382978e8-f061-435c-bc7f-1001</v1:ConversationID>
</v1:Correlation>
<v1:Source>
<v1:CountryCode>GB</v1:CountryCode>
<v1:Operator>customer</v1:Operator>
<v1:Division>CustomerManagement</v1:Division>
<v1:System>ccc</v1:System>
<v1:Timestamp>2015-03-30T09:30:10Z</v1:Timestamp>
<v1:Identity>
<v1:Token>a.user@xxx.com</v1:Token>
</v1:Identity>
</v1:Source>
<wsa:Action>action_anonymized</wsa:Action>
<wsa:MessageID>uuid:2b97effe-f997-4424-b996-436067bf515c</wsa:MessageID>
<wsa:RelatesTo>uuid:e6dd9c95-53e7-4a5a-8361-c233f494a788</wsa:RelatesTo>
<To xmlns="http://www.w3.org/2005/08/addressing">http://www.w3.org/2005/08/addressing/anonymous</To>
</soap:Header>
<s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Body>
<ns0:Fault xmlns:ns1="http://www.w3.org/2003/05/soap-envelope" xmlns:ns0="http://schemas.xmlsoap.org/soap/envelope/">
<faultcode>OSB-101</faultcode>
<faultstring>OSB ERROR</faultstring>
<detail>
<ns0:Fault xmlns:ns0="http://group.customer.com/contract/vfo/fault/v1" xmlns:ns2="http://group.customer.com/contract/vho/header/v1" xmlns:ns3="http://group.customer.com/schema/common/v1" xmlns:ns6="http://docs.oasis-open.org/wsrf/bf-2" xmlns:ns7="http://www.w3.org/2005/08/addressing">
<ns6:Timestamp>2017-03-09T08:32:28.788Z</ns6:Timestamp>
<ns6:ErrorCode>500</ns6:ErrorCode>
<ns0:Name />
<ns0:Severity>Critical</ns0:Severity>
<ns0:Category>Technical</ns0:Category>
<ns0:ReasonCode>ReasonCode</ns0:ReasonCode>
<ns0:Message>The Contact ID [666888777] with Contact Login [null] doesnot exist in the CIAM system.</ns0:Message>
</ns0:Fault>
</detail>
</ns0:Fault>
</soapenv:Body>
</s:Body>
</soapenv:Envelope>
虽然我可以拦截它并引发(编辑:抛出)一个异常,但我想弄清楚为什么没有正常引发它,即Message.isFault对于这个响应是假的,而其他的那些&#39;看&#39;对于其他服务故障响应,确实有.isFault为true并且捕获了FaultExeception。 我检查了[FaultContractAttribute]的服务/方法的存在性: -
[System.ServiceModel.FaultContractAttribute(typeof(CSUAccount.FaultType), Action="action_anonymised", Name="Fault", Namespace="http://group.customer.com/contract/vfo/fault/v1")]
答案 0 :(得分:0)
这是提供程序问题,服务器未将此响应设置为错误。我不知道服务器问题是什么,除了提供商告诉我它已被修复&#39;