beast
beast

Reputation: 127

How to Handle Fault Contracts in Biztalk

ERROR:

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

operation used in WCF-custom send port:

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

I used the generated binding file when I consumed the webservice.

Webservice code:

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

When I try to handle the faultcontract this mismatch is showing up. or am I missing something here.

Upvotes: 0

Views: 633

Answers (1)

Dieter
Dieter

Reputation: 655

The Action of a WCF send adapter is based on the SOAP action header (or BtsActionMapping) configuration in the WCF send adapter and/or the properties BTS.Operation and BTS.Action.

It looks like the WCF adapter is unable to match the action with the configured action in your send adapter. As a result of this, the action is set to this string:

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

Did you specify the BTS.Operation = "MyOperation" in the context of your message?

Few (other) possibilities:

    1. Write the action in the context of the message
    BTS.Operation = "MyOperation"
    and configure ActionMapping in the SOAP action header configuration:
    <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. Write the action in an orchestration and leave the SOAP action header configuration empty:
    OutboundMessage(WCF.Action)= "http://tempuri.org/Class/MyOperation";
    3. Configure a fixed action in the SOAP action header configuration in the adapter configuration:
    http://tempuri.org/Class/MyOperation

A great article on MSDN related to SOAP actions configuration for send ports can be found here: Specifying SOAP Actions for WCF Send Adapters

Upvotes: 1

Related Questions