Author Archive

BizTalk And SVN

I have always struggled with using Biztalk and SVN.  These couple of blogs helped me bit.

Setting Auto Properties – Keep in mind with windows 7 You would be going to %USERPROFILE%/AppData/Roaming/Subversion for the config file suggested in the blog below.


Setting up Scheduled Task Adapter

After I published a post to get the scheduled task adapter to work (by gacing the assemblies) I had someone ask me if I had a tutorial on setting up the properties for the adapter.  So here it is.
This is based on the previous version of the adapter not the lastest one.

Step 1: Create a receive location by creating a receive port or defining an existing receive port and choose the type to be “ScheduledTask” adapter

Step 2: Click on the configure button and click the Task Tab

Step 3: Click the FindTask button and then the browse to the location of the scheduled task dlls

Step 4: Select the Task Component dll

Step 5: Choose “XmlStringStreamProvide” and double click to populate “Assembly Qualified Type Name”

Step 6:Hit OK and “…” to bring up the XMLText Editor

Step 7: Type in the message that you want the adapter to put in the message box.  To generate this message, (if you have followed the solution architecture as outlined in Dan R’s book) you can generate an instance of the internal schema.  Hit ok..

Step 8: Click the schedule tab to specify the schedule.  There are various options, and in this example, I would be using weekly so that I can drop the message every day at 4:55 pm

Step 9: Choose XML Transmit pipeline and thats basically it.



Using BizTalk to Parse a FlatFile with Multi line header and trailers

Today I was asked to parse a Bloomberg file with had multi line header and trailer with pipe separated body.  Here is a file that was given to me


# Automatically generated by Bloomberg Data License Request Builder version 5.0.24
# Build Code: 010001101000000015


TIMESTARTED=Mon Jun  4 13:39:31 EDT 2012
SPX Index|0|1|01/02/2009|903.25|
SPX Index|0|1|01/05/2009|931.8|
USISDA30 Index|0|1|06/04/2012|2.301|
TIMEFINISHED=Mon Jun  4 13:39:33 EDT 2012

Instead of going the standard route of splitting the header, body and trailer – what I chose to do was to split on Words instead of CR/LF.

Step1) Open FlatFileSchema Wiz and define your name space and root. Choose the file that needs to be parsed.

Step 2) Choose “By Delimiter Symbol” and click Next.

Step 3) Instead of choosing a simple {CR}{LF} use the word that splits the Header and Body – In this case I used “START-OF-DAY{CR}{LF}”

Step 4) On the next screen set the first element as “Header” and Element Type as FieldElement (Since we dont want to split the header).  On the second element though, choose the element type to be “Record” so we can split the data

Step 5) Now the Body and the trailer is automatically selected

Step 6) Do steps 2- 5 now choosing “END-OF-DATA{CR}{LF}” instead of Start of data

Step 7) Now you would be at a familiar point to split the records.

Hopefully this helps to split MultiLine headers and footers.

Mapping Multiple Records into Single Record

The problem came up again to map Multiple records into a Single Record.  I know I had solved it once but had spaced out – so I decided to blog about it so that it would help me as well as others who are in the same situation.

This is what I had:

<DATA type="subject">test subject 6</DATA>
<DATA type="name">test subject 6</DATA>
<DATA type="category">Other</DATA>
<DATA type="from-email"></DATA>
<DATA type="from-name">test name</DATA>
<DATA type="clickthru">on</DATA>
<DATA type="clickthru-text">off</DATA></RECORD></DATASET>

And I wanted to map it into :

<ns0:Root xmlns:ns0="http://InternalSchemas.CrmContactHistory">

This is where I found the looping functoid extremely useful: Here is the Picture of how the map looks:

Check the looping functoid

Check out the use of looping functoid.  The “Equal” functoids map the element into the appropriate element of the outbound schema


Using Scheduled Task Adapter with BizTalk Server 2010

There is absolutely no documentation or may be very little associated with the Scheduled Task adapter on codeplex.  I will try to provide some tips and gotchas when using this adapter.  This is a very powerful adapter and I have used it in couple of my applications and used it to put raw xml in message box.

To use this adapter you will obviously have to install the adapter.  Unfortunately, it does not GAC a couple of assemblies even when you choose “everyone” on the install page.  To solve that problem I have created a MSI for installing the required assemblies into GAC.  You can download the installer from here.  Once the adapter is installed and the assemblies are GAC’d, you will have to follow general instructions on adding “ScheduledTask” as an adapter.  

Once the adapter is added, there are a couple of Gotcha to get the adapter working

1) After you have created the port, select the adapter, and click configure.  Provide a name.  This will be displayed as part of the URI on the port configuration page. 

2) Set the schedule

3) On the Task Tab, click Find Task.  #1) This page, if you are using the adapter for the first time, will be blank.  Click Browse and locate the directory where the adapter was installed (usually :<system drive:>\Program Files (x86) \ Biztalk ScheduledTask Adapter) and choose “ScheduledTaskAdapter.TaskComponents.dll” and click open.  Double click on the required stream provider (should populate the “Assembly Qualified Type Name” textbox and hit Ok.

4) This should populate the Class Text Box and would have “Task Properties” Populated with various properties.  Specify your text (in my case it was XML Stream and I put in raw XML) and hit ok.

5) You would think you are done. but no – #2) You will also have to add the “Biztalk.Adapter.ScheduledTaskProperties.dll” as a resource to your application and select the Gac’ing options.

6) Occasionally you might see an exception in the event long

The adapter “Schedule” raised an error message. Details “Exception has been thrown by the target of an invocation.”

This indicates that the the assemblies are not gac’d or they are not picked up. If you have already run the MSI and have added the dll as a resource, you need to restart the Host Instance.  Another reason why you might see this error is because your host instance might be running in 64 bit mode.  Ensure that the host instance is running as 32 bit.





Raw UDP Adapter – Listener

My previous blog I showed how easy it is to create a UDP broadcast adapter.  The problem with using the soap.udp adapter is that the message is wrapped in a soap envelope.  I tried various way in vain to get around the soap envelope so that I can broadcast or receive messages without the extra fat.  Although for most part it soap envelope would not matter, but just for kicks, I wanted to receive data without soap, I decided to write an adapter.

I followed this tutorial (echo adapter) and made the following changes to include socket connections.  On initialization, I create and bind the socket to the ip and port

listener = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);
localEndPoint = new IPEndPoint(IPAddress.Parse(RemoteAddress), RemotePort);
endpoint = (EndPoint) localEndPoint;

On background worker, I open the connection and start listening.

if (IsConnected)
   ReceiveStarted = true;
   while (!StopReciving)
      byte[] data = new byte[1024];
      int receive = listener.ReceiveFrom(data, ref endpoint);
      var receivedData = Encoding.ASCII.GetString(data, 0, receive);
      lock (inboundQueueSynchronizationLock)
          Message requestMessage = Message.CreateMessage(MessageVersion.Default, "UDP/Data",

And basically thats all. Download the full code here.  The zip file includes the code and projects for setup and custom action.

UDP Broadcast using BizTalk Server 2010

Recently we had talked about developing an adapter to broadcast data over UDP.  The idea was to develop such an adapter that can be used in private equity firms to receive price data over multicast.

Yesterday I had a chance to try out Dot Net 4.5 (currently in beta) which natively supports UDPBindings.  I never realized broadcasting data over UDP would be such a simple task that I could implemented a send port in a matter of minutes with 0 coding. Well 0 coding to set the port up but may be a few lines of code for the UDP receiver.

Setting up a UDP Send port

In your BizTalk application, create a send port of WCF-Custom Type.  In the General tab, set the End Point Address URI to be



On the Binding Tab, Select the Binding Type to be “udpBinding”.  Leave the defaults as is


Set the other required files and maps on your port and that’s it.  You can now broadcast messages over UDP.

Client Code

Here is the client code that I used to test my UDP Transmission.

            const int GROUP_PORT = 15000;
            //const string IP_ADDRESS = "";
            const string IP_ADDRESS = "";
            Socket listener = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);
            IPEndPoint localEndPoint = new IPEndPoint(IPAddress.Parse(IP_ADDRESS), GROUP_PORT);
            EndPoint ep = (EndPoint)localEndPoint;
            Console.WriteLine("Ready to receive…");
            byte[] data = new byte[1024];
            int recv = listener.ReceiveFrom(data, ref ep);
            string stringData = Encoding.ASCII.GetString(data, 0, recv);
            Console.WriteLine("received: {0} from: {1}", stringData, ep.ToString());

Its a pure socket based connection and works like a charm.

In my BizTalk application, my UDP Broadcast port was subscribing to a file receive port.  For both ports the pipeline was simple pass through.  I dropped in a simple xml file with data:

<?xml version="1.0" encoding="utf-8"?>
<data>WORKING PARTY</data>

And this is what I received on my client console application:

<s:Envelope xmlns:s="" xmlns:a=""><s:Header><a:MessageID>urn:uuid:9552802b-0168-431f-b694-eff5fed86a47</a:MessageID><a:To s:mustUnderstand="1">soap.udp://</a:To></s:Header><s:Body><data>WORKING PARTY</data></s:Body></s:Envelope>