Posts Tagged ‘ BizTalk Server 2010 ’

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);
listener.Bind(localEndPoint);
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",
                                                                       receivedData);
          InboundQueue.Enqueue(requestMessage);
       }
    }
}

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

BizTalk – Solution Template

Note: If you have Visual Studio 11 (beta) installed double clicking the template will not work.  I have added a bug report.  The problem seems to be with the VSIXInstaller.exe shipped with the beta.  You should use the 2010 VSIXInstaller for the template to successfully install. 

EXAMPLE:
C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE>VSIXInstaller.exe "C:\Users\mabhyankar\Documents\Visual Studio 2010\Projects\TemplateCreator\Multi-Project Templates Sample Solution\VSIXProject2\bin\Release\BizTalkFinalTemplateDR.vsix"

The solution template based on Dan Rosanova’s book – BizTalk Patterns 2010 is now complete.  Dan suggests in his book to structure the solution into 5 projects + 1 Unit test.

  • External Schemas: Schemas for the external parties
  • Internal Schemas: Canonical schemas
  • Maps: Maps internal to external schemas and vis-a-versa.
  • Orchestrations: Based on Internal schemas
  • Pipelines
  • Unit Tests

The solution template build the solution exactly how Dan Recommends.  It even creates other recommended folders and creates a signing key and adds it into the project.

Here is a link to download the template.

Link to the source code for solution template.

A visual studio caveat:

Visual studio saves the ApplicationName, ConfigurationDatabase, Restart Host Instance information in the .user file of the project.  This file is updated only when the user closes the visual studio solution.  I haven’t found a way to replace these parameters in the .user file.  So the solution template creates a .bat file that you can run which will replace the visual studio created .user files with the ones that you need.  But keep in mind that you have to close the visual studio project before you run the .bat file otherwise, VS will overwrite all the .user files with what it thinks is correct.

Enjoy the solution template.