locked
BTS.Correlation token RRS feed

  • Question

  • Hi Experts,

    I am writing WCF Custom Extension to capture the Request and response while calling WCF services form BizTalk.

    My Requirement is I need to capture Request and Response for instance in the same file(XML format).

    I know how to implement the IMessageInspector interface to achieve this.

    to Capture Request and Response in the same file I need to catch hold of the BTS.CorrelationToken(Which gets promoted on Req and Res port ) while calling WCF services,If I catch the BTS.correlation token I can do the remaining coding part ,Please help me to achieve this.

    The same solution we can achieve with the pipeline component but we don't want Pipeline component, I am doling with the custom Extension objects.

    Thanks&Regards,

    Ammu.

    Monday, March 16, 2015 6:05 PM

Answers

  • Hi John,

    Thanks for your quick response on this.

    Finally I have achieved this with IClientMessageInspector.

    I have added one property GUID in class which is implementing the IClientMessageInspector

    and initialized in constructor of the class.

    Used this GUID in BeforeSendRequest and AfterReceivedReply methods to write the XML in the file share

    I used GUID as file name  BeforeSendRequest---File Creating with RequestXML

                                          AfterReceivedReply ---File Append with ResponseXML.

    Thanks &Regards,

    Ammu


    • Edited by Ammu_Biz Tuesday, March 17, 2015 1:48 AM
    • Marked as answer by Ammu_Biz Tuesday, March 17, 2015 1:39 PM
    • Unmarked as answer by Ammu_Biz Tuesday, March 17, 2015 1:39 PM
    • Marked as answer by Ammu_Biz Tuesday, March 17, 2015 4:59 PM
    • Unmarked as answer by Ammu_Biz Tuesday, March 17, 2015 4:59 PM
    • Marked as answer by Angie Xu Wednesday, March 25, 2015 7:27 AM
    Tuesday, March 17, 2015 1:48 AM

All replies

  • Why can't  you use a Pipeline Component?  For that matter, why not just use an Orchestration?*

    Sure, you can use a Message Inspector, but it's new really the BizTalk way.  But if you do go down that route, why do you need the CorrelationToken? The Message Inspector is per instance and has access to both sides of the conversation.

    Basically, there are much easier way to accomplish what you're probably trying to do.

    *Don't even think about 'performance' unless you can prove there's a problem.

    Monday, March 16, 2015 6:53 PM
    Moderator
  • Hi John,

    Thanks a lot for quick response.

    I can achieve this using Pipeline component but I need to use the Custom extension in BizTalk process and Some other .Net Application also there I need to use it in both of these applications if I can implement in Custom extension behaviours, But if I implement in pipeline, I cant use that in .NET application, That is the reason why I am going with the Custom Extensions.

    Now question is I want to capture BTS.Correlation Token to correlate the Req and Res.

    or

    Is there any similar property (Which should be same in Req and Reply).

    Monday, March 16, 2015 7:32 PM
  • Ok, reusing this in another WCF client is probably the only legit reason to do it this way, cool.

    However, in the .Net client, you won't have BTS.CorrelationToken so you can't build a dependency there anyway.

    Either way, assuming you're using IClientMessageInspector, you get both the request and response messages so you don't really need to correlate them.

    Monday, March 16, 2015 7:54 PM
    Moderator
  • Hi John,

    Thanks for your quick response on this.

    Finally I have achieved this with IClientMessageInspector.

    I have added one property GUID in class which is implementing the IClientMessageInspector

    and initialized in constructor of the class.

    Used this GUID in BeforeSendRequest and AfterReceivedReply methods to write the XML in the file share

    I used GUID as file name  BeforeSendRequest---File Creating with RequestXML

                                          AfterReceivedReply ---File Append with ResponseXML.

    Thanks &Regards,

    Ammu


    • Edited by Ammu_Biz Tuesday, March 17, 2015 1:48 AM
    • Marked as answer by Ammu_Biz Tuesday, March 17, 2015 1:39 PM
    • Unmarked as answer by Ammu_Biz Tuesday, March 17, 2015 1:39 PM
    • Marked as answer by Ammu_Biz Tuesday, March 17, 2015 4:59 PM
    • Unmarked as answer by Ammu_Biz Tuesday, March 17, 2015 4:59 PM
    • Marked as answer by Angie Xu Wednesday, March 25, 2015 7:27 AM
    Tuesday, March 17, 2015 1:48 AM