Muokkaa

Jaa


Specifying SOAP Actions for WCF Send Adapters

You can set the WCF.Action context property in the WCF send adapter transport properties dialog box or in the orchestration Expression shapes. If you set the WCF.Action context property in the orchestration, you need to leave the Action field blank in the WCF adapter transport properties dialog box for the static send ports. If you also specify an action in the static send ports, the WCF.Action context property you set in the orchestration will be overridden.

Moreover, there are two ways to specify this property: the single action format and the action mapping format. If you set this property in the single action format—for example, http://MyService/IMyContract/MyAction1—the SOAP action in the WCF send adapter transport properties dialog box for outgoing messages is always set to the value specified in this property. Alternatively, you can set the single action format in the orchestration Expression shape. For example,

OutboundMessage(WCF.Action)="http://MyService/IMyContract/MyAction1";  

If you set this property in the action mapping format, the outgoing SOAP action is determined by the BTS.Operation context property. For example, if this property is set to the following XML format in the WCF send adapter transport properties dialog box and the BTS.Operation property is set to Operation_1 in the send port in the orchestration, the WCF send adapter uses http://MyService/IMyContract/MyAction1 for the outgoing SOAP action.

BtsActionMapping xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">  
<Operation Name="Operation_1" Action="http://MyService/IMyContract/MyAction1" />  
<Operation Name="Operation_2" Action="http://MyService/IMyContract/MyAction2" />  
<Operation Name="Operation_3" Action="http://MyService/IMyContract/MyAction3" />  
</BtsActionMapping>  

Specifying action mapping for WCF.Action in an Expression shape is not supported. You need to specify the action mapping in the WCF transport properties dialog box. Then the WCF adapter will look up the SOAP action by using the BTS.Operation context property, which the orchestration sets to the name of the operation on the port where the message is sent.

If outgoing messages are routed with content-based routing (CBR) where the http://schemas.microsoft.com/BizTalk/2003/system-properties#Operation property is not set, WCF send adapters will set the whole action mapping string to the action of the outgoing WCF messages. To work around this, you can do one of the following:

  • Set the action field on the send port to http://MyService/IMyContract/MyAction1.

  • Set the BTS.Operation context property in a pipeline. For example, set the value of http://schemas.microsoft.com/BizTalk/2003/system-properties#Operation to Operation1.

  • Leave the action field blank and use the action from the incoming message instead.

    You can also use the BizTalk WCF Service Consuming Wizard to consume the WCF services with single action or action mapping. For more details, see How to Use the BizTalk WCF Service Consuming Wizard to Consume a WCF Service.

See Also

Configuring Dynamic Send Ports Using WCF Adapters Context Properties