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.
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
- Envelop Schema:
- Document Schema
- Destination Schema:
Map: Document Schema to Destination Schema
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.
- 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.
- Orchestration Receive Filter:
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);
- Define Resolver if used in Orchestration Extender:
ResolverCollection = itineraryStep.ItineraryStep.ResolverCollection;
ResolverDictionaryString = ResolverCollection.Current;
- All below variable need to create in variable section in Orchestration view as below:
Other variables are in System.String format.
- 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);
XMLDocument = InboundMsg;
ResponseString = Microsoft.Practices.ESB.Transform.MapHelper.TransformMessage(XMLDocument.OuterXml,mapName);
OutboundMsg = XMLDocument;
OutboundMsg(*) = InboundMsg(*);
//Below code for sending to next itinerary step
- Create Send port to send the OutboundMsg On Send port correlation set also need to initialize as per below
- 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.
One more correlation type for ESB Itinerary:
- 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:
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
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:
- Create Receive Location and assign the ItinerarySelectReceiveXml pipeline for that.
Below configuration need to setup in this pipeline property.
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
- Create Send Port with having following filter:
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
- Create Itinerary Server as orchestration Extender and Orchestration name in Service Name property as below:
- Define Resolver which is expecting to define in Orchestration
- Define off Ramp as below:
- Define OffRamp Extender and Resolver as below
Now export this itinerary and deploy BizTalk application and test. Good luck