Conditional JSON encoding on send pipeline on Dynamic port

Hi,

I have a scenario where i am using a dynamic send port to make a few service calls. Depending on the message type, I would sometimes need to make a service call which accepts only a JSON request and returns a JSON response. Please can you suggest the way to achieve this.

I do not want to branch in the orchestration and have 2 send ports. I was thinking of having a pipeline component which would look up the message type on the outbound message and does a JSON encoding if it matches the message type (which i could check from a BRE ? ).  Please advice on the best approach to solve this problem.

note: I am using BizTalk 2013 and using open source newtonsoft dlls for JSON handling.

Thanks and Regards,

August 31st, 2015 8:46am

How many different msg types do you expect ? Do all the different msg type belong together in the same business process ??

You can very well use a custom pipline or an extension of WCF behaviour to branch out ur requirement. Or if an if else in expression in orch where u encode ur outgoing msg before sending if u dont want to branch out.

Free Windows Admin Tool Kit Click here and download it now
August 31st, 2015 9:14am

Hi,

Thanks for the pointers. There are close to 15 different types of messages that can go through the pipeline now. It is an evolving number and there could be more types of messages going through in the future. i am trying to avoid branching in the orchestration.

The approach I was thinking is,

1.set a context property on the outbound message if JSON encoding is required

2.read the property in the custom pipeline component and perform JSON encoding if set to true

1.On the incoming side (response), if the encoding is present, decode using custome pipeline component, else pass through.

Please let me know your thoughts on my approach or any other approach. 

Regards,

Ujjwal

August 31st, 2015 10:35am

Hi Ujjwal,

There is BRE pipeline framework created by Johann which handles these problems.

https://brepipelineframework.codeplex.com/

Cheers

Free Windows Admin Tool Kit Click here and download it now
September 1st, 2015 1:44am

1.set a context property on the outbound message if JSON encoding is required :- Since you are anyway deciding this based on MessageType which is already in context, you dont really need any extra context property , I think..

2.read the property in the custom pipeline component and perform JSON encoding if set to true : Have a pipeline property say (JSONEncodingMessageTypes), and set comma or pipeseparated MessageTypes at runtime properties, for which you want encoding. (Would give u a common json encoder pipeline componet which u can reuse)

1.On the incoming side (response), if the encoding is present, decode using custome pipeline component, else pass through. -- Should be fine

September 1st, 2015 2:15am

Hi,

Thansk for the approach. I am implementing the same now.

Regards,

Ujjwal

Free Windows Admin Tool Kit Click here and download it now
September 1st, 2015 7:54am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics