Monday 28 July 2014

Invalid Characters Prefixed with the Files

    Have got the issue reported from the receiver (Customer), that I am sending some special characters like below along the XML document. But I could not find the cause for this special characters as there is no encryption or custom pipeline used.

   After some Hours of Googling, I found the solution – Preserve BOM from the stack overflow forum, which is fixed and working fine.

Issue and solution:

       There is a Pipeline (XML Transmit) Property which has properties called as “Preserve BOM” as shown below, if it is set is true, then the file will be prefixed with BOM – check the link for more information on using BOM.

For my issue, I have set the flag to false, and then it seems that the file sent does not contain any special characters (BOM) which solves the issue.

Wednesday 29 May 2013

Receiving Message via HTTP Port and sending back the Acknoledgement

   The below link have the clear Explanation in step by step tutorials to receive the XML message from the client and sending back the acknowledgement using the HTTP Adapter.

Tuesday 16 April 2013

BizTalk SSO Configuration Data Storage Tool

             We can able to use the SSO Store to storing the Data's, that we similarly do in the Biztalk Config file BtsNtSvc.config.

There is lot of Advantages using the SSO Store as explained in the below link.

  The Tool below is for the SSO Configuration, which is really simple to use.

Monday 27 August 2012

Biztalk Suspended Messages Email Notification

In Biztalk it is usual to get the message suspended due to some run time issues or due to some other reasons.
But we need to be notified when the message is suspended in the console with the error description (cause for the suspension).

We can achieve this by enabling the Routing Failure reports in the Console and consume the message by the Send Port (SMTP) and we can notify by a  mail.

But when the Routing Failure report is enabled the suspended message is not available in the console that is we can’t able to resume the suspended messages later, because the message is consumed.
To Achieve the notification and also the Messages need to be suspended in the console, we can achieve By Custom Pipelines , tools like Biztalk360 ( and by querying the database.

By using the stored Procedure (Querying the DB) , we can query and get the suspended messages and the error reason and send a notification mail (Database Mail ) in a HTML format as shown below. 

Sample Mail with the List of Suspended Messages with the appropriate Application Name, Adapter Name, URI,Reason

below links helps in configuring  the Database Mail 

Scheduled Task to Execute the Stored Procedure :

To get Notified you can schedule the Task and as per the scheduled time, the suspended messages will be consolidated in a table and send a mail as shown above.

Bat File to Run the Stored Procedure which needed to schedule the Task :

You can create a bat file with the below code by replacing the appropriate values

    sqlcmd -Q "EXEC  [databaseName].[dbo].[storedProc Name] " 
                  -S SystemName 
                  -d DatabaseName
                  -E -o      C:\log.txt

Thursday 10 May 2012

BizTalk - Errors and Warnings, Causes and Solutions

The below link has some common Biztalk Errors/Warnings and the corresponding Causes and Solutions, Definitely that would help for a day to troubleshoot these issues in the Biztalk Server.

Thursday 8 December 2011


Custom Pipelines
Introduction To Pipelines
BizTalk is a message-based system receiving and sending data inside messages. Sometimes the incoming and outgoing messages must be processed to fit to external formats. Pipelines, attached to send ports and receive locations, are the components through which the messages pass, then the data format is recognized and can be validated or changed if necessary; as well as the metadata is extracted and added to the message context.
Receive and send pipelines in BizTalk are used to perform a range of processing and operations on messages. Some of them are listed below
1)      Encrypt and decrypt messages
2)      Sign and verify digitally signed messages
3)      Validate message against schema.
4)      Deal with promoted properties used for content based routing.
5)      Disassemble or break single message into multiple.
6)      Wrap messages with header and footer
This post contains the Steps to create the custom Pipelines.
A pipeline component is a .NET or COM component that implements a set of predefined interfaces for interaction with the BizTalk Messaging Engine. Depending on the functionality of the component, different interfaces must be implemented. 
Every pipeline component must support the IPipelineComponent interface. Without this interface, a Commerce Server pipeline will not be able to execute the component. The remaining interfaces are optional. They expose various types of functionality that allow new components to fit smoothly into the Commerce Server architecture.
The following table lists the required IPipelineComponent interface and the other optional interfaces.

Executes the component.
This interface is required.
Sets and retrieves the properties on a component using a Dictionary object.
This interface is optional.
Uses a SAFEARRAY to identify the OrderForm object and PipeContext object elements that a component reads and writes.
This interface is optional.
Displays a dialog box for configuring a pipeline component.
This interface is optional.
Determines the object that will be invoked through the IPipelineComponentUI interface to display the dialog box for the component.
This interface is optional.
Indicates that the object supports property pages.
This is a standard OLE interface. This interface is optional.
Persists the data associated with an object to a stream. This is the form of persistence used in the Active Template Library (ATL) Pipeline Wizard.
This is a standard OLE interface. This interface is optional.
Persists the data associated with an object to a Dictionary object.
This is a generic persistence interface defined by Commerce Server. This interface is optional.

Steps Creating Custom Pipeline:

From the Link, you can download the Biztalk Server Pipeline Component Wizard. [Simplifies our Process].
 Steps to Build the Pipeline Wizard
  1. Open the PipeLineComponentWizard.sln [Downloaded, ensure that you have downloaded the correct version what you use, i.e., for VS 2008 or VS 2010].
  2.  Build PipelineComponentWizard.sln and navigate to PipelineComponentWizard Setup Folder.
  3. We can find the setup.exe and PipelineComponentWizard Setup.msi in the Debug/Release Folder.
  4.  Just Run the Setup.exe.

 5)      Once installed we can find the BizTalk Server Pipeline Component in the Splash Screen, when creating the Project.

Steps Creating the Receive Pipeline Using the Wizard
  1. Create a new Biztalk Server Pipeline Component as shown below using the above component                                                 
  2. In this step, we need to specify the Classname, namespace, and component type sand the language we are gona implement the pipeline.      
  3. We can choose Send/Receive/Any pipeline according to our Design. In this we choose Receive.              
  4. If we choose Receive, we can decode, disassemble, validate, party resolver or any.                                   
  5. If we choose Send, we can Encode, Assemble, or any.
  6. Next we must set the UI Settings [ Pipeline Component Appearance settings in Biztalk appln]  
  7. We need to provide version, Component name, description and Icon.

     4.    Next we need to specify the variable name that the pipeline component will use.

    5.     Finish Creating the Pipeline Skeleton:

   6     The Thing we need to do is to apply our logic.

a.       As this sample is Receive we selected the Decode
b.      WE need to apply our logic over here.[TODO]

         public Microsoft.Biztalk.Message.Interop.IBaseMessage   
               Execute(Microsoft.BizTalk.Component.Interop.IPipelineContext pc,                                                                                                                    
               Microsoft.BizTalk.Message.Interop.IBaseMessage inmsg)



                  // TODO: implement component logic
                  // this way, it's a passthrough pipeline component
                     return inmsg;

7)      Same process to create the Send Pipeline also.

Sample Send Pipeline Logic to Test:

After completing the above logic, you can test the pipeline using this simple logic below.

      public Microsoft.BizTalk.Message.Interop.IBaseMessage
     Execute(Microsoft.BizTalk.Component.Interop.IPipelineContext pc,
     Microsoft.BizTalk.Message.Interop.IBaseMessage inmsg)
      XmlDocument xmlDoc = new XmlDocument();
      xmlDoc.Save(@"C:\Documents and Settings\uset\Desktop\Output.xml");
      xmlDoc.Load(@"C:\Documents and Settings\uset\Desktop\Envelope.xml");
      string PMessage = xmlDoc.OuterXml;
      byte[] byteArray = Encoding.ASCII.GetBytes( PMessage );
      MemoryStream stream = new MemoryStream( byteArray );
      inmsg.BodyPart.Data = stream;
      xmlDoc.Save(@"C:\Documents and Settings\uset\Desktop\ReturnMsg.xml");

      inmsg.BodyPart.Data.Position = 0;
      return inmsg;

The above codes just replace the received file and send another file to the Biztalk.

Using the Custom Pipeline In the Biztalk:

1)      Sign the Pipeline and ensure that the pipeline dll is available in the assembly.
2)   In the Biztalk application add the Receive/Send Pipeline shape [ as Designed Pipeline component].
3)  Right click the toolbox in the Pipeline Designer and choose items, select pipeline components and select your component.
4)      Drag you component to the pipeline.