none
WCF-Custom Adapter and using customBinding RRS feed

  • Question

  •  

    Hi,

    I am using WCF-Custom adapter and using customBinding. In the custom binding I defined channel stack, where the channel stack contains chunking channel and msmqTransport. I have following questions,

    (1) How do we pass custom message contract object to BizTalk WCF service?

     

    (2) I have message contract object, which containn some information in message header and payload information in message body as a stream object. In BizTalk adapter there are three options available to extract WCF message information into BizTalk message body. I am using full Envelop but I need to change this envelop to custom schema which is defined in the bizTalk. How can we access header properties and body stream from the custom pipeline component? (From the IBaseMessage object)

     

    (3) In the WCF service method we can define operation behaviours (for example Transaction scope requiresd, Transaction auto complete etc.)  Is possible to define these attributes in the BizTalk WCF service (in BIzTalk WCF ports)?

     

    (4) When we call the BizTalk WCF servce, how the client know the exactly which port it is going to call (According to the WCF, ABC (address, binding and contract) should satisfy? where A and B is fine but how applicable is C?

     

    (5) When we call the external WCF service inside BizTalk, How the ABC will work? because we are not specifying contract.

     

    (6) When we call the external WCF service inside BizTalk, why do we need to specify Action="*" or ReplyAction="*"? What is the good practice? (I mean giving Namespace with action name and refering in BizTalk or some otherway)

     

    (7) Is possible streaming in BizTalk WCF adapters? (WCF-Custom adapter and using customBinding)

     

    Thanks

     

    Anslum

     

    Monday, October 29, 2007 7:54 AM

Answers

  •  

    I take try the answers I know first:

    (1) How do we pass custom message contract object to BizTalk WCF service?

    Answer:

    On the receive side, BizTalk uses an Untyped, Raw messaging pattern. In otherwords, it uses the "Message" class with the action set to "*" (All operations).  It's Interface can either be TwoWay (Default) or Oneway (in the case of MSMQ bindings). the method signature will always look like this "Message BizTalkSubmit(Message)" in the case of a TwoWay port.  How the contract is marked up with WCF Attributes depends on if you're using TwoWay with/without Transactions and etc.  Thus there is not need to pass a "Custom" message contract because all messages are accepted.

     

    (2) I have message contract object, which containn some information in message header and payload information in message body as a stream object. In BizTalk adapter there are three options available to extract WCF message information into BizTalk message body. I am using full Envelop but I need to change this envelop to custom schema which is defined in the bizTalk. How can we access header properties and body stream from the custom pipeline component? (From the IBaseMessage object)

    Answer:

    So here's a quick question/thought for you, if you're using the Full Envelope as the message body, you must also be using the passThroughPipeline currently, with thoughts to move to a custom one which means that none of your Message Context, or Message Part promoted properties are being promoted.  However your adapter properties are, am I correct?

    To help with your question, a custom pipeline component can read all adapter promoted properties, and property promoted values depending on the stage the component lives in. the WCF.CustomInboundHeaders, and WCF.CustomOutboundHeaders are WCF Adapter promoted properties that you can use within your custom pipeline component.

     

    (3) In the WCF service method we can define operation behaviours (for example Transaction scope requiresd, Transaction auto complete etc.)  Is possible to define these attributes in the BizTalk WCF service (in BIzTalk WCF ports)?

    Answer:

    You can define similar settings only on bindings that support Transactions. You define this inside the Binding settings for a particular WCF Adapter. If you need fine line granularity, use the WCF Custom adapter.  FYI, the Transaction Scope, and Auto complete settings are operation behaviours that affect the Runtime performance of the ServiceHost inside the ServiceModel. These operations are Preset on the Receive side, take a look at the various ITwoWayXXX interfaces. They are marked appropiately with the settings you are looking for.  These Interfaces are automatically implemented based off of the binding options you select within the WCF Adapter for a receive location.

     

    (4) When we call the BizTalk WCF servce, how the client know the exactly which port it is going to call (According to the WCF, ABC (address, binding and contract) should satisfy? where A and B is fine but how applicable is C?

    Answer:

    Refer to the very first question/answer set above.  BizTalk uses a Untyped messaging pattern, Action="*" and Message Type = "Message"  Individual operation behaviors are then applied according to the binding options chosen by the WCF Adapter. For multiple Receive Locations, you can control which Endpoints are exposed using the WCF Publishing Wizard, and using an IIS WCF Service Endpoint to control MEX addresses and physical endpoints that the client can discover or use. So the the client, it's just a service, however the contract will always be very similar : Message BizTalkSubmit( Message ) [Marked up with transactions, IsOneWay, and Action="*" ] depending on the WCF Adapter binding configuraiton.

     

    (5) When we call the external WCF service inside BizTalk, How the ABC will work? because we are not specifying contract.

     

    (6) When we call the external WCF service inside BizTalk, why do we need to specify Action="*" or ReplyAction="*"? What is the good practice? (I mean giving Namespace with action name and refering in BizTalk or some otherway)

    Answer:

    When send data to a WCF service, you specify the Action, and the URI and Bindings. (A, B) the contract is then fullfilled by the Message Body you send to the Service. Using Action="*" is only for sending to a WCF Service for BizTalk, or another WCF service that expects this.

    Inside BizTalk you can dynamically specify these options using the BTS Action Mapping and the BTS.Operation message context promoted property inside orchestrations.

     

    (7) Is possible streaming in BizTalk WCF adapters? (WCF-Custom adapter and using customBinding)

    I don't think their are any limitations here, so Yes why not, if you can do Binary encoding over Http, using a WCF Custom Adapter, then why not.

     

     

    HTH

    -Dwight

    Thursday, November 1, 2007 8:41 PM

All replies

  •  

    I take try the answers I know first:

    (1) How do we pass custom message contract object to BizTalk WCF service?

    Answer:

    On the receive side, BizTalk uses an Untyped, Raw messaging pattern. In otherwords, it uses the "Message" class with the action set to "*" (All operations).  It's Interface can either be TwoWay (Default) or Oneway (in the case of MSMQ bindings). the method signature will always look like this "Message BizTalkSubmit(Message)" in the case of a TwoWay port.  How the contract is marked up with WCF Attributes depends on if you're using TwoWay with/without Transactions and etc.  Thus there is not need to pass a "Custom" message contract because all messages are accepted.

     

    (2) I have message contract object, which containn some information in message header and payload information in message body as a stream object. In BizTalk adapter there are three options available to extract WCF message information into BizTalk message body. I am using full Envelop but I need to change this envelop to custom schema which is defined in the bizTalk. How can we access header properties and body stream from the custom pipeline component? (From the IBaseMessage object)

    Answer:

    So here's a quick question/thought for you, if you're using the Full Envelope as the message body, you must also be using the passThroughPipeline currently, with thoughts to move to a custom one which means that none of your Message Context, or Message Part promoted properties are being promoted.  However your adapter properties are, am I correct?

    To help with your question, a custom pipeline component can read all adapter promoted properties, and property promoted values depending on the stage the component lives in. the WCF.CustomInboundHeaders, and WCF.CustomOutboundHeaders are WCF Adapter promoted properties that you can use within your custom pipeline component.

     

    (3) In the WCF service method we can define operation behaviours (for example Transaction scope requiresd, Transaction auto complete etc.)  Is possible to define these attributes in the BizTalk WCF service (in BIzTalk WCF ports)?

    Answer:

    You can define similar settings only on bindings that support Transactions. You define this inside the Binding settings for a particular WCF Adapter. If you need fine line granularity, use the WCF Custom adapter.  FYI, the Transaction Scope, and Auto complete settings are operation behaviours that affect the Runtime performance of the ServiceHost inside the ServiceModel. These operations are Preset on the Receive side, take a look at the various ITwoWayXXX interfaces. They are marked appropiately with the settings you are looking for.  These Interfaces are automatically implemented based off of the binding options you select within the WCF Adapter for a receive location.

     

    (4) When we call the BizTalk WCF servce, how the client know the exactly which port it is going to call (According to the WCF, ABC (address, binding and contract) should satisfy? where A and B is fine but how applicable is C?

    Answer:

    Refer to the very first question/answer set above.  BizTalk uses a Untyped messaging pattern, Action="*" and Message Type = "Message"  Individual operation behaviors are then applied according to the binding options chosen by the WCF Adapter. For multiple Receive Locations, you can control which Endpoints are exposed using the WCF Publishing Wizard, and using an IIS WCF Service Endpoint to control MEX addresses and physical endpoints that the client can discover or use. So the the client, it's just a service, however the contract will always be very similar : Message BizTalkSubmit( Message ) [Marked up with transactions, IsOneWay, and Action="*" ] depending on the WCF Adapter binding configuraiton.

     

    (5) When we call the external WCF service inside BizTalk, How the ABC will work? because we are not specifying contract.

     

    (6) When we call the external WCF service inside BizTalk, why do we need to specify Action="*" or ReplyAction="*"? What is the good practice? (I mean giving Namespace with action name and refering in BizTalk or some otherway)

    Answer:

    When send data to a WCF service, you specify the Action, and the URI and Bindings. (A, B) the contract is then fullfilled by the Message Body you send to the Service. Using Action="*" is only for sending to a WCF Service for BizTalk, or another WCF service that expects this.

    Inside BizTalk you can dynamically specify these options using the BTS Action Mapping and the BTS.Operation message context promoted property inside orchestrations.

     

    (7) Is possible streaming in BizTalk WCF adapters? (WCF-Custom adapter and using customBinding)

    I don't think their are any limitations here, so Yes why not, if you can do Binary encoding over Http, using a WCF Custom Adapter, then why not.

     

     

    HTH

    -Dwight

    Thursday, November 1, 2007 8:41 PM
  • Hi Dwight,

    Thank you very much for the answers, Question 1, 3, 4, 5 and 6 fine.

     

    For Question 2, I am using custom pipeline for transform the received "message contract" to "bizTalk schema" object. Where earlier I specified "Full Envelop" option but i could not read the stream out of the message, so maked to "XPath option" (third option in message) and specified blank expression. after that I could read stream seperately from the IBaseMessage.BodyPart.GetOriginalDataStream() and headers from IBaseMessage.Context.Read() method.

     

    For Question 7, I have problem when stream my "message contract" object. Is there are any to stream message contract? because I used XmlSerializer but it did not send body part to service method (service method has "Message contract" as a parameter)

     

    Thanks

     

    Anslum

    Friday, November 2, 2007 7:59 AM
  • (2) - This is correct, and if you wanted to specify a specific element, you cound specify an XPath expression to use as the Message Body and read the content within the Pipeline component.  If you want a quick and easy way to use a Map within a Pipeline take a look at the TransformComponent inside the ESB toolkit. It allows you to choose a mapt to do excatly what you're looking to do.

     

    (7) - You can use Classes decorated with [Message Contract] to send to the WCF Service. Just use the XmlWrapper option on the WCF Send Adapter to format the correct message structure.  Also make sure you have the correct Action= setting that the WCF service is expecting.  Just to reiterate, WCF uses the Action, Binding, and Message format to check against the Contract for the Dispatcher to send the message to the correct operation.  If you're having problems sending data to the WCF Service, turn on tracing and view exactly what Message looks like from BizTalk, and compare it to a desktop proxy call using a class from the svcutil (One you'll have to build).

     

    FYI- as another note, if you calling this WCF from an orchestration, you can use the Add Generated Items...-> Consume WCF Service Wizard to help you out.

     

    HTH

    Friday, November 2, 2007 4:49 PM
  • Hi  Dwight .

    Thank you for the advice for question 2, For question 7, If I give the message structure into the "Messages" tab (used template option), then my all the custom header elements are eliminated in the outgoing WCF message. I set my custom headers following way,

     

    const string standardHeader = "OutboundCustomHeaders";

    const string standardNamespace = http://schemas.microsoft.com/BizTalk/2006/01/Adapters/WCF-properties;

    pInMsg.Context.Write(standardHeader, standardNamespace, "<Header><MyValue>1</MyValue></Header>");

     

    Further, In my body envelop I need to send stream object and header, I need to send custom header values. To support both how do I configure the Biztalk adapter. In addition, my custom binding, earlier I mentioned one attribute in contract, How can i set this attribute in Biztalk WCF adapter? (This attribute, I internally using in my channel stack)

     

    Thanks

     

    Anslum

    Monday, November 5, 2007 2:19 PM