ESB Itinerary in Orchestration

Sometimes orchestration need to involve in ESB itinerary to achieve business complexity and making more loosely coupled solution.

Here in below sample project, I provide solution for how to de-batch incoming message and applying mapping then sends to send port.

We can directly de-batch incoming message in ESBSelectReceiveXML pipeline on receive port without use of orchestration. But if we involve mapping on document schema also after de-batching then we need to introduce Orchestration extender in ESB Itinerary to implement mapping resolver otherwise it will through exception.

Requirement:

Reference Dlls in BizTalk Solution for ESB implementation in Orchestration:

  • C:\Program Files (x86)\Microsoft BizTalk ESB Toolkit\Bin\Microsoft.Practices.ESB.Itinerary.dll
  • C:\Program Files (x86)\Microsoft BizTalk ESB Toolkit\Bin\Microsoft.Practices.ESB.Itinerary.Schemas.dll
  • C:\Program Files (x86)\Microsoft BizTalk ESB Toolkit\Bin\Microsoft.Practices.ESB.Resolver.dll
  • C:\Program Files (x86)\Microsoft BizTalk ESB Toolkit\Bin\Microsoft.Practices.ESB.Resolver.Container.dll

Schema:

  • Envelop Schema:

Sample:

Envelop.jpg

  • Document Schema

Document.jpg

  • Destination Schema:

Destination.jpg

Map: Document Schema to Destination Schema

Map.jpg

Itinerary:

Itinerary.jpg

Orchestration:

Orchestration.jpg

Note: In case of orchestration extender, we need to set up receive and send message in System.Xml.XmlDocument format. It will not work with specific schema format. After receiving the xml doc in orchestration you can assign the xml document to specific schema and define the work flow and when you need to send back message to ESB itinerary then also you need to convert into in System.Xml.XmlDocument format then send.

Orchestration configuration:

  1. Binding type should be direct for Logical Receive/Send port, which are connect to ESB Itinerary.

Note: when one orchestration used in Itinerary then you should use Request/Response Port. When you need to use multiple orchestration in Itinerary then you can use separate Receive and send port.

  1. Orchestration Receive Filter:

FilteronOrchestration.jpg

3. Next in expression shape: Define ESB Itinerary objects as below:

itinerary = new Microsoft.Practices.ESB.Itinerary.SerializableItineraryWrapper();

itineraryStep = new Microsoft.Practices.ESB.Itinerary.SerializableItineraryStepWrapper();

itinerary.Itinerary = Microsoft.Practices.ESB.Itinerary.ItineraryOMFactory.Create(InboundMsg);

itineraryStep.ItineraryStep = itinerary.Itinerary.GetItineraryStep(InboundMsg);

  1. Define Resolver if used in Orchestration Extender:

ResolverCollection = itineraryStep.ItineraryStep.ResolverCollection;

ResolverCollection.MoveNext();

ResolverDictionaryString = ResolverCollection.Current;

  1. All below variable need to create in variable section in Orchestration view as below:

Variable.jpg

Variable Variable Definition
itinerary Microsoft.Practices.ESB.Itinerary.SerializableItineraryWrapper
itineraryStep Microsoft.Practices.ESB.Itinerary.SerializableItineraryStepWrapper
ResolverCollection Microsoft.Practices.ESB.Itinerary.ResolverCollection
ResolverDictionary Microsoft.Practices.ESB.Resolver.ResolverDictionary
XMLDocument System.Xml.XmlDocument

Other variables are in System.String format.

  1. In MessageAssignment shape following code should be written, Here Resolver Service is executed. Resolver service can be change and update on business requirement basis. Here Static transformation (Mapping) is used ( Resolver defined in ESB Itinerary):

ResolverDictionary = Microsoft.Practices.ESB.Resolver.ResolverMgr.Resolve(InboundMsg, ResolverDictionaryString);

mapName= ResolverDictionary.Item(“Resolver.TransformType”);

XMLDocument = InboundMsg;

ResponseString = Microsoft.Practices.ESB.Transform.MapHelper.TransformMessage(XMLDocument.OuterXml,mapName);

XMLDocument.LoadXml(ResponseString);

OutboundMsg = XMLDocument;

OutboundMsg(*) = InboundMsg(*);

//Below code for sending to next itinerary step

itinerary.Itinerary.Advance(OutboundMsg,itineraryStep.ItineraryStep);

itinerary.Itinerary.Write(OutboundMsg);

  1. Create Send port to send the OutboundMsg On Send port correlation set also need to initialize as per below
  2. Correlation set and correlation type also need to set up, because direct binding used on Receive/Send Port. Correlation need to be initialize on send port.

Below correlation type need to setup for Request/Response port.

CorrelationForPipeline.jpg

One more correlation type for ESB Itinerary:

ESBCorrelation.jpg

  1. Now deploy this Solution and add the ESB config file

Note: If there is require exception handling also in orchestration in ESB management console then

Go to following link:

https://vkbiztalk.com/2017/12/28/esb-exception-handling-in-orchestration/

ESB Config File:

Insert orchestration details in ESB config file located at C:\Program Files (x86)\Microsoft BizTalk ESB Toolkit\esb.config

So that it will be available in ESB Itinerary as orchestration extender.

Open ESB.Config file which in the ESB Toolkit installation folder and add configurations as below under “ItineraryServices”. Below details need to fill in config file.

  • Type: Orchestration dll info
  • Name: Orchestration Name (Name can be change, Whatever name is providing here, same need to apply on Receive Shape filter in orchestration and same name publish in Service Name in Orchestration Extender in ESB Itinerary)
  • Stage: None
  • Scope: Orchestration
  • Id: GUID

ESBConfig.jpg

Note: This config file only need to update in development environment because ESB Itinerary need to set up. When we deploy in UAT or Production Server then It not require updating the esb.config file because ESB itinerary directly get details from database.

BizTalk Configuration on Admin Console:

  1. Create Receive Location and assign the ItinerarySelectReceiveXml pipeline for that.

Below configuration need to setup in this pipeline property.
ReceivePipeline.jpg

If in your BizTalk admin console there are several applications use similar kind of schema then you can provide EnvelopeSpecName and DocumentSpecName to not get any exception. More details you can get here

https://vkbiztalk.com/2018/03/21/same-schema-in-different-biztalk-applications/

  1. Create Send Port with having following filter:

SendPortFilter.jpg

Here Microsoft.Practices.ESB.Itinerary.Schemas.ServiceName is define the Itinerary name.

ESB Itinerary Configuration:

  • Create a ESB Itinerary file
  • Set OnRamp with BizTalk application

OnRamp.jpg

  • Create Itinerary Server as orchestration Extender and Orchestration name in Service Name property as below:

Orch_Extender.jpg

  • Define Resolver which is expecting to define in Orchestration

MapResolver.jpg

  • Define off Ramp as below:

OffRamp.jpg

  • Define OffRamp Extender and Resolver as below

OffRamp_Extender.jpg

 

Now export this itinerary and deploy BizTalk application and test. Good luck

 

 

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s