如何在Biztalk中处理故障契约

时间:2014-11-27 08:10:38

标签: wcf soap biztalk

错误

<s:Fault xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"><faultcode xmlns:a="http://schemas.microsoft.com/ws/2005/05/addressing/none">a:ActionNotSupported</faultcode><faultstring xml:lang="en-US">The message with Action '&lt;BtsActionMapping xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"&gt;
  &lt;Operation Name="MyOperation" Action="http://tempuri.org/class/MyOperation" /&gt;
&lt;/BtsActionMapping&gt;' cannot be processed at the receiver, due to a ContractFilter mismatch at the EndpointDispatcher. This may be because of either a contract mismatch (mismatched Actions between sender and receiver) or a binding/security mismatch between the sender and the receiver.  Check that sender and receiver have the same contract and the same binding (including security requirements, e.g. Message, Transport, None).</faultstring></s:Fault>

在WCF自定义发送端口中使用的操作:

<BtsActionMapping xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <Operation Name="MyOperation" Action="http://tempuri.org/Class/MyOperation" />
</BtsActionMapping>

我在使用webservice时使用了生成的绑定文件。

Webservice代码:

  public interface Class
    {
        [OperationContract]
        [FaultContract(typeof(FaultClass))]
        Response Myoperation(List<getattributes> getattributes);
    }

当我尝试处理故障合同时,这种不匹配现象出现了。或者我在这里遗漏了什么。

1 个答案:

答案 0 :(得分:1)

WCF发送适配器的操作基于WCF发送适配器中的SOAP操作头(或BtsActionMapping)配置和/或属性BTS.Operation和BTS.Action。

看起来WCF适配器无法将操作与发送适配器中配置的操作相匹配。因此,操作设置为此字符串:

<BtsActionMapping xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">   <Operation Name="MyOperation" Action="http://tempuri.org/class/MyOperation" /> </BtsActionMapping>

您是否在邮件的上下文中指定了 BTS.Operation =“MyOperation”

很少(其他)可能性:

    1.在消息的上下文中编写动作
    BTS.Operation = "MyOperation"
    并在SOAP操作头配置中配置ActionMapping:
    <BtsActionMapping xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
      <Operation Name="MyOperation" Action="http://tempuri.org/class/MyOperation" />
    </BtsActionMapping>
    2.在业务流程中编写操作,并将SOAP操作头配置保留为空:
    OutboundMessage(WCF.Action)= "http://tempuri.org/Class/MyOperation";
    3.在适配器配置中的SOAP操作头配置中配置固定操作:
    http://tempuri.org/Class/MyOperation

有关发送端口的SOAP操作配置的MSDN上的一篇很棒的文章可以在这里找到:Specifying SOAP Actions for WCF Send Adapters