Thursday, October 2, 2014

First ESB Itinerary Project

To create an itinerary :
1. Create Dynamic send port with following filters -
Microsoft.Practices.ESB.Itinerary.Schemas.ServiceName == XYZ And
Microsoft.Practices.ESB.Itinerary.Schemas.ServiceState == Pending  And
Microsoft.Practices.ESB.Itinerary.Schemas.ServiceType == Messaging

Select pipeline as - Itinerary Send PassThrough

2. Create Itinerary named as HelloWorld.itinerary
Refer - http://geekswithblogs.net/BizTalkAndOtherTechs/archive/2013/05/21/152969.aspx
 http://geekswithblogs.net/BizTalkAndOtherTechs/archive/2013/05/22/152978.aspx

3. Select itinerary on receive location – Select “ItinerarySelectReceive” pipeline and open pipeline properties to configure following:
ItineraryFactKey Resolver.Itinerary
ResolverConnectionString ITINERARY://name=HelloWorld;

3. Create Orchestration to be used as service
3.1 Develope .odx
3.2 Register it in ESB.config as service


Commonly faced errors and resolutions:


ErrorResolution
There was a failure executing the receive pipeline: "Microsoft.Practices.ESB.Itinerary.Pipelines.ItinerarySelectReceive, Microsoft.Practices.ESB.Itinerary.Pipelines, Version=2.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" Source: "ESB Itinerary Selector" Receive Port: "ReceiveXml" URI: "C:\Users\XYZ\*.xml" Reason: Parameter name cannot be null or an empty string.
Parameter name: key 
The issue was that I had the BRI string like this: BRI:// instead of BRI:\\  in the pipeline component's configuration.  The latter is the correct way.

Also, verify in your on-ramp (receive location) that you have the ItineraryFactKey property set to "Resolver.Itinerary".

ESB Itinerary Error: The published message could not be routed because no subscribers were found

 http://wlopezm.blogspot.co.uk/2012/04/esb-itinerary-error-published-message.html

Friday, June 20, 2014

CDATA Mapping

I was struggling with mapping requirement in which I needed to map input xml to CDATA section on one of string type field in output.
This one helped -
http://stephenomo.blogspot.co.uk/2011/11/convert-xml-file-to-string-inside.html

Thursday, May 15, 2014

XML Document and property promotion

I had a custom code which returned XMLDocument(xDoc). In my orchestration, I created a message of type XLANG.BaseType.Any (msgAny)
Did following -
msgAny=xDoc;

I wanted message type to be promoted . I used trick of correlation on BTS.MessageType.
But it failed :( :(

After digging at all wrong places, I came to know that msgAny, when assigned value of xml document, it is treated as XDoc and not as XLANG type.
I developed a custom pipeline component and invoked the custom pipeline in my orchestration.
:) :)
And it worked :)
 

Thursday, May 8, 2014

Schema validation in BizTalk WCF Service

Input Validation in a service created using BizTalk WCF Service publishing wizard by "Exposing schema as WCF service" :

I created a WCF service by exposing  schema. To my surprise, the service created is happily accepting all types of messages - regardless of message format/target namespace.

I thought such service have inbuilt restrictions to accept specific type of messages - as per the schema type defined while generating the service.
But I was WRONG!! :( :(

Now what..I need to find out ways to get this done. :|

Trying for MSDN  help -

http://social.msdn.microsoft.com/Forums/en-US/a7a9d957-ea98-4c92-9b4a-5446f00eb519/validation-in-auto-generated-wcf-service?forum=biztalkgeneral

Monday, April 21, 2014

XML Disassembler Vs XML Validator

Validation in pipeline -
http://blog.codit.eu/post/2012/11/14/Some-lines-about-XML-validation-in-BizTalk.aspx

It is worth noting the difference between validation behavior of  XML Disassembler & XML Validator component.


XML Disassembler XML Validator

Validates document structure only
Validates both structure and defined restrictions
Validates against configured document schema only.
If the input message has another TargetNamespace#RootNodeName combination,
an exception will be thrown (can’t recognize the data)


Validates against schema configured.
If the input message has another TargetNamespace#RootNodeName combination, no XML validation will be performed.
If document schema is not configured, error received - "Validation can only be performed when document schemas are provided."

If document schema is not configured, it retrieves the XML definition from the BizTalkMgmtDb, at run-time, using the TargetNamespace#RootNodeName combination. And validates against the same.
If no relevant schema found for input message validation, error received - "The XML Validator cannot retrieve the document specification using the type 'XXX' "
If document schema is configured improperly(or fully qualified schema name not configured), error received - "No Disassemble stage components can recognize the data." If document schema is configured improperly(or fully qualified schema name not configured)
  "The document specification <TestSchemaWrongName> from assembly <Schemas, Version=1.0.0.0, Culture=neutral, PublicKeyToken=df56015ea0377400> failed to load. Verify the schema for this document specification is deployed and is in the Global Assembly Cache."
If validation fails, error received - "Validation failed." If validation fails, error received - The 'http://TestDocumentSchema:InvalidFieldName' element has an invalid value according to its data type.

One more finding - we can specify multiple schemas in property DocumentSchema. They will have fully qualified name, separated by '|' . e.g.
RnD.Schemas.Request,RnD.Schemas, Version=1.0.0.0, Culture=neutral, PublicKeyToken=df56015ea0377400 | RnD.Schemas.Error,RnD.Schemas, Version=1.0.0.0, Culture=neutral, PublicKeyToken=df56015ea0377400