Integration Experts – Dipesh Avlani

BizTalk Server, WCF, WF and Cloud computing…

Tracing and Tracking ESB events

Posted by DipeshA on May 28, 2012

Many a times one may feel the need to trace ESB events when using itineraries. This will enable you to see how a message is getting processed by the ESB itinerary resolver and if something is going wrong there. The process of enabling this switch is quite simple and it involves the following:

Tracing

1) Open the BizTalk Configuration file, ie BTSNTSVC.exe.config

2) Add the following section (if one does not exist)  and save the file:

<system.diagnostics>

<sources>

<source name=”BizTalk ESB Toolkit 2.0″ />

</sources>

<switches>

<add name=”BizTalkESBToolkit20″ value=”4″ />

</switches>

<trace autoflush=”true” indentsize=”4″ >

<listeners >

<add name=”myListener”   type=”System.Diagnostics.EventLogTraceListener” initializeData=”BizTalk ESB Toolkit 2.0″ />

</listeners>

</trace>

</system.diagnostics>

Note: 
Add a Trace listener. If you don't already have a trace listener configured, add 1 of the many Trace listeners that come out of the box with the .Net framework: (Default, EventLog, TextWriter, Console, Text, etc.)
When using the EventLogTraceListener, the initializeData attribute must be set to the source of the Tracing Event. 
In this case it is the "BizTalk ESB Toolkit 2.0" source.

3) Restart the BizTalk Host Instance.

4) You will now see information and error events in the event viewer. Also if you have debugview running, you will see code traces there.

Tracking

After enabling tracing, you might still feel the need for tracking. That is, what went where? Every Itinerary Service has a property called ‘Tracking Enabled’ which you’ve got to set it to ‘True’ during the design phase. This sets the stage for tracking an Itinerary Service. Set this property for every single service in an Itinerary as this is false by default. Only those services whose ‘Tracking Enabled’ property is set to true will show up in the database.

Ok, tracking is set to true and my itinerary is deployed. Where do I see this tracing information?

When a service in an itinerary is set for tracking, it is recorded in the BAMPrimaryImport database in the table bam_ItineraryServiceActivity_Completed. the column itineraryBeginTime should be used to sort the results by datetime.

This table gives a snapshot view of the trajectory of the message and if each stage in its path was completed or pending.

Posted in BizTalk 2006/2009, ESB Toolkit, General | Tagged: , , , , | Leave a Comment »

WCF-SQL Adapter and permissions

Posted by DipeshA on April 16, 2012

If you are using a WCF SQL adapter in your solution, it is imperitive to set permissions on the stored procedures you call from within BizTalk. However, if you havent set permissions, the error message can be a little misleading.

The adapter failed to transmit message going to send port “WcfSendPort_SqlAdapterBinding_TypedProcedures_MyDB” with URL “mssql://MYSRVSQ01//MyDB?”. It will be retransmitted after the retry interval specified for this Send Port. Details:”Microsoft.ServiceModel.Channels.Common.MetadataException: Object [dbo].[uspInsertRecords] of type StoredProcedure does not exist

The above message can be quite confusing especially when the stored procedure does exist in your database. The above basically means the BT host account does not have execute permissions on the stored procedure being called. You need to restart the BT host instance after setting permissions.

Now, lets see what happens when I have a working solution (my permissions are set) and I revoke the execute permission on the same stored proc (remember, I havent restarted the BT host after revoking the permission). I now see this error message:

The adapter failed to transmit message going to send port “WcfSendPort_SqlAdapterBinding_TypedProcedures_MyDB” with URL “mssql://MYSRVSQ01//MyDB?”. It will be retransmitted after the retry interval specified for this Send Port. Details:”System.Data.SqlClient.SqlException: The EXECUTE permission was denied on the object ‘uspInsertRecords’, database ‘MyDB’, schema ‘dbo’.

This seems to be a much more clear message, isint it? However, if you restart the BT host and try processing your file again, you will see the first error.

Posted in BizTalk 2006/2009, BizTalk 2010 | Tagged: , , | 1 Comment »

BizTalk with ReST

Posted by DipeshA on March 9, 2012

There is a great article posted by Microsoft which explains how BizTalk can be configured to call a ReST service. You can find it here.

Althought this article is based on BizTalk 2010 (.net 4.0), I have tested this with BizTalk 2009 (.net 3.5) and it works.

Check it out!

Posted in BizTalk 2006/2009, BizTalk 2010, BizTalk 2010 R2, ReST | Leave a Comment »

BizTalk – Overlapped I/O operation is in progress

Posted by DipeshA on March 1, 2012

While configuring BizTalk features (BAM Tools or Sharepoint Adapter), you may have issues getting the cofiguration process to succeed with the error below:

“Overlapped I/O operation is in progress”

Certain blogs suggest that registry changes be made to force it to work. This is a bit risky once it comes to prod environments. The best approach to fix such issues is to repair the BizTalk installation and try configuring BizTalk again.

Posted in BizTalk 2006/2009, BizTalk 2010 | Leave a Comment »

Scheduling BAM Packages – failure in ‘Set global connection string variables’

Posted by DipeshA on February 22, 2012

I recently hit an issue while configuring a sql job to process my BAM cubes by running the BAM_AN_* packages with the following error:
Code: 0×00000000
Source: Set global connection string variables
Description: Object reference not set to an instance of an object.

I later found that this was due to the user under which the SQL Server Agent Service runs not having enough permissions on SQL Server. I changed the user to a sql server service account and I no longer got this error while running the sql job. Alternatively, you can also run this service under the network service account if your BAM databases are on a different server.

Posted in BAM, BizTalk 2006/2009, BizTalk 2010 | Leave a Comment »

“the binary code for the script is not found…”

Posted by DipeshA on February 7, 2012

When you deploy a BAM activity, it creates at least one SSIS package for the activity which will create partition tables and move any activity instances within the archive window to the BAMArchive database.  If you’ve created any BAM views which create an OLAP cube, an SSIS package will also be created to move the data between the relational tables and the cube as well.  These SSIS packages are stored on the SQL server, in the MSDB database instance on the default server instance.

So SSIS needs to be installed on the SQL Server not the BizTalk server.  But what does need to be installed on the BizTalk server? See below…

You need to install:
1) Client Tools SDK
2) Client Tools Backwards Compatibility (this is critical).
+ the management tools as shown above.

I recently hit this issue while trying to run the BAM_AN_ SSIS package in SQL Server 2008 in order to load the activity data to the cube and got “the binary code for the script is not found”. What this means is the SSIS packages created by the BM utility has not been compiled. If you try and open the resulting dtsx package in Visual Studio, you are likely to see a dialog indicating that the package is corrupt. Lastly I had to  undeploy the existing BAM view and redeploy and the error went away!

Below are the screens I saw before and after installing the missing components.

Before:

After:

Hope it helps someone!

Posted in BAM, BizTalk 2006/2009, BizTalk 2010, General | Leave a Comment »

More cloud based integration posts coming up

Posted by DipeshA on January 16, 2012

As we move towards the cloud, we need to be able to expose endpoints on the cloud for integration that follows a hybrid model (see my previous post that describes what a hybrid model is) . In the next few days, I will be writing posts that demonstrate how BizTalk can be used to talk to Azure service bus and other cloud based services.
Meanwhile, msdn has avery interesting article on this and can be found here.

 

 

Posted in Azure, BizTalk 2010, BizTalk 2010 R2, BizTalk Azure, General | Tagged: , , | Leave a Comment »

The Future of Integration with MS Technologies

Posted by DipeshA on January 9, 2012

With the announcement of BizTalk Server 2010 R2, it is clear that there is great commitment from MS for supporting on-premise solutions. However, one other smart move from MS was they are now catering to all the three areas below:

Area: On-Premises Integration
Products:

BizTalk Server
Windows Server AppFabric

Area: Hybrid Integration
Products:

BizTalk Server
Windows Azure AppFabric
Windows Server AppFabric

Area: Cloud Integration
Products:

Windows Azure AppFabric

BizTalk 2010 R2 boasts improvements in the following areas:

Development Environment Support:
1) Visual Studio 2011
2) SQL Server 2012
3) Windows 8
4) Easy migration from BizTalk Srv 2010

Updates & Improvments:
1) Updated schemas and accelarators. Eg: HIPPA, HL7, SWIFT
2) Support for faster batch processing.
3) Improved performance with ordered send ports.
4) Support for new data sources. Eg IBM informix.

Cloudification:
1) Easily extend on-premise apps to the cloud.
2) Tighter integration with Windows Azure Service Bus.
2) Licensing geared towards cloud licensing.

Posted in BizTalk 2010 R2 | Tagged: , , | 1 Comment »

BizTalk 2010 R2 Due for Release

Posted by DipeshA on December 9, 2011

BizTalk 2010 R2 is due for release soon…

http://blogs.msdn.com/b/biztalk_server_team_blog/archive/2011/12/08/biztalk-server-2010-r2.aspx

Posted in General | Tagged: | Leave a Comment »

Mocking up XLANGMessage and XLANGPart to unit test BizTalk components

Posted by DipeshA on November 17, 2011

BizTalk developers have often felt the need to unit test any dotnet components called from within an orchestration. However, messages passed to dotnet components are of type XLANGMessage and this class is an abstract class, therefore rendered useless when it comes to initialising these types in your unit tests. The way around this is to mock both the XLANGMessage and XLANGPart classes.

The best way to mock these classes is to run reflector on the xlang base types dll and look at the definition of these classes.

As you can see, both these classes are abstract classes and can be inherited and the behavior added. Below is the code the these mock classes. The key here is the constructor of these classes which will help us use them like any other class.


using System;
using Microsoft.XLANGs.BaseTypes;
using System.Xml.Schema;

namespace IntegrationExperts.BusinessObjects.Tests.MockClasses
{

public class MockXLANGPart : XLANGPart
{

readonly T _obj;

#region ctor

public MockXLANGPart(T obj) { _obj = obj; }

#endregion

#region props

public override string Name
{
get { return "MockXLANGPart"; }
}

public override XmlSchema XmlSchema
{
get { throw new NotImplementedException(); }
}

public override XmlSchemaCollection XmlSchemaCollection
{
get { throw new NotImplementedException(); }
}

#endregion

#region funcs

public override object GetPartProperty(Type propType)
{
throw new NotImplementedException();
}

public override Type GetPartType()
{
throw new NotImplementedException();
}

public override string GetXPathValue(string xpath)
{
throw new NotImplementedException();
}

public override void LoadFrom(object source)
{
throw new NotImplementedException();
}

public override void PrefetchXPathValue(string xpath)
{
throw new NotImplementedException();
}

public override object RetrieveAs(Type t)
{
if (t == typeof(T))
{
return _obj;
}
return null;
}

public override void SetPartProperty(Type propType, object value)
{
throw new NotImplementedException();
}

#endregion

#region dispose

public override void Dispose() { }

#endregion

}

}

//----------------------------------------------------------------------

using System;
using System.Collections;
using System.Collections.Generic;
using Microsoft.XLANGs.BaseTypes;

namespace IntegrationExperts.BusinessObjects.Tests.MockClasses
{

public class MockXLANGMessage : XLANGMessage
{

readonly List<MockXLANGPart> _parts = new List<MockXLANGPart>();

#region ctor

public MockXLANGMessage(T obj)
{
_parts.Add(new MockXLANGPart(obj));
}

#endregion

#region props

public override int Count { get { return _parts.Count; } }

public override string Name
{
get { return "MockXLANGMessage"; }
}

public override XLANGPart this[int partIndex]
{
get { return _parts[partIndex]; }
}

public override XLANGPart this[string partName] { get { return _parts[0]; } }

#endregion

#region funcs
public override void AddPart(XLANGPart part)
{
throw new NotImplementedException();
}

public override void AddPart(object part, string partName)
{
throw new NotImplementedException();
}

public override void AddPart(XLANGPart part, string partName)
{
throw new NotImplementedException();
}

public override object GetPropertyValue(Type propType)
{
throw new NotImplementedException();
}

public override void SetPropertyValue(Type propType, object value)
{
throw new NotImplementedException();
}

public override IEnumerator GetEnumerator()
{
return _parts.GetEnumerator();
}

#endregion

#region dispose

public override void Dispose() { }

#endregion

}

}

Add these classes to your unit test project and in the test class, you can write tests as shown below:


[TestMethod]
public void DoActionTest()
{

   var msg = new MySchemaClass(); //schema class can be generated via tools like XSD to code.
   var xlang = new MockXLANGMessage(msg); // Create a new mock XLANGMessage to wrap the message
   DoAction(xlang); // Call the method to be tested by passing in the mock XLANGMessage
   //Assert.IsTrue(....);
}
internal static void DoAction(XLANGMessage message)
{

   var myObj = new MySchemaClass();//schema class can be generated via tools like XSD to code.
   myObj = (MySchemaClass)message[0].RetrieveAs(MySchemaClass.GetType()); //retrieve parts of the message.

   //var val1 = myObj.prop1;
   //var val2 = myObj.prop2;
   //perform additional tasks as per your testing requirements.
}

Posted in BizTalk 2006/2009, BizTalk 2010 | Leave a Comment »

 
Follow

Get every new post delivered to your Inbox.