BizTalk 2006, MSMQ and BizTalk 2002

BizTalk 2006, MSMQ and BizTalk 2002

A little over a year ago I posted
an entry
about a new feature included in the MSMQ Send Adapter in BizTalk 2006
which provided a way to send messages through MSMQ from BizTalk to legacy applications
that required the message contents to be formatted using the ActiveXFormatter, or
that simply used the old COM-based MSMQ API.

However, I didn’t mentioned anything about how to enable the opposite scenario: How
to receive and parse a text message in BizTalk 2006 coming from one of those legacy
applications. Someone recently asked about this on the BizTalk Newsgroup and, as It
turns out, BizTalk Server 2002 happens to fall in this category as well.

Fortunately, this scenario is a lot simpler, if we assume that the contents of the
message will be plain text (say, some string content or XML). The ActiveX message
serialization rules dictate that a message with a BodyType of String will simply be
serialized on the wire as a set of bytes encoded using UCS-2 (UTF-16LE), without a
Byte Order Mark (BOM).

BizTalk can parse UTF-16 contents without problems, but without a BOM, the standard
disassemblers can’t figure out the encoding of the message on it’s own.

Fortunately, most of the time you can work around this by setting the message Charset
before parsing (for example using my own FixEncoding pipeline
component).

technorati BizTalk, MSMQ

Slides from my ASP.NET Connections Orlando Talks

Last week I presented at the ASP.NET Connections Conference in Orlando.  I gave a general session talk on Monday, and then two breakout talks later that day.  You can download my slides+samples below:

General Session

The slides for my keynote can be downloaded here. 

In the talk I demonstrated how to debug the .NET Framework source code.  You can learn how to set this up with VS 2008 here. 

I also demonstrated building a site using the new ASP.NET Dynamic Data support – which you can learn more about here.  I also demonstrated using the new ASP.NET MVC Framework – which you can learn more about here.

I also showed off the new Hard Rock Memorabilia site built with Silverlight 2.  You can try out the Hard Rock application yourself here.  You can learn more about Silverlight from my links page here.

Building .NET Applications with Silverlight

The slides + demos for Silverlight breakout talk can be downloaded here.

You can learn more about Silverlight from my links page here.  In particular, I recommend reading my tutorial posts here and here.

ASP.NET MVC

The slides + demos for my ASP.NET MVC talk can be downloaded here.

You can learn more about the latest ASP.NET MVC source refresh here.  Stephen Walther also just posted a really good set of slides + demos from his post conference tutorial on ASP.NET MVC here.

Hope this helps,

Scott

BizTalk: Debuging the BizTalk applications with the direct test send ports

” …I have published an orchestration as a web service and consumed it from an aspx page. now, how do I see if I triggered the orchestration and how and where do I get the output (transformed message of the orchestration)? …“


It is a very common question, how to debugging the BizTalk applications.

Have you ever tried to use the BizTalk Orchestration Debugger? So painful experience. Never see the BizTalk developer who is using it in real work.

 

One simple decision is creating the direct test send ports.  (http://blogs.msdn.com/kevin_lam/archive/2006/07/07/659214.aspx, http://geekswithblogs.net/LeonidGaneline/archive/2006/12/18/101541.aspx)

Test port is a port with the filter expression (http://msdn2.microsoft.com/en-us/library/aa578042.aspx, http://msdn2.microsoft.com/en-us/library/aa547903.aspx). This expression creates the subscription to the message you interested in.

All sent and received messages go through the MessageBox. When they pass MessageBox you can create additional subscription to these messages and intercept copies of these messages.

The subscription can be to the message type or to the publisher parameters like Receive port name.

This technique has great benefits:



  • The direct test send ports do not disturb the original message flow (excluding the rare case when all main subscriptions to the debugged message have got unenlisted).


  • They can be easily switch on/off.

As a matter of fact I use two methods on the regular basis. (The second one is the old good Trace.WriteLine(..) with DebugView.exe as a receiver of the debug output.) That means I always create the orchestrations with the Expression shapes (for Trace.WriteLine)) after all message receives/transformations, in the begin/end all branches, plus I create the test send ports for almost ALL messages.

 

Yes, for ALL output messages.

It is easy and fast to create the test send ports in the binding file without using UI.

And I always deploy these test ports to the production. It saved me a lot of time in deployment and maintain.

Searching *Inside* Stored Procedures

I’ve recently inherited a large BizTalk system and needed a quick way to determine which custom stored procedures accessed which tables/views and called other sprocs. Thanks to my co-worker Shaun, I now have the power of the INFORMATION_SCHEMA views at my disposal!
Information Schema Views
Information schema views provide an internal, system table-independent view of SQL Server […]

BizTalk 2006 R2, EDI and RFID SCOM2007 Management Pack Released!!! Yeah baby!

We’ve now got official Management Pack support for R2 and the newer things in R2 such
as EDI and RFID.

I’ve had many students come up to me and say “Mick – what in the world are you talking
about?”

(mind you I get that at home as well – but let’s not go there)

Have you ever asked the question:
I wonder how our BizTalk (et. al.) servers are going?

(this is where you could send the work experience kid around to all the servers gathering
details and report back to you by lunch…..but not all of us have work experience
kids)

The answer to this is relatively complex – as you’ll need know things like:

  1. Services – stopped, started, uptime. BizTalk Services, SQL Services, WCF/IIS Services
    etc.
  2. Database sizes, Spool table lengths
  3. Queue Lengths – disk etc.
  4. Memory details
  5. BizTalk Orchestration details
  6. Messaging Details
  7. …. and the list goes on.

SCOM2007 with the management pack gives you that – in near enough realtime with all
sorts of graphs and charts.

One of the *best* things I like about SCOM2007 is that you install the Management
Pack(s) only on *one* machine – usually the SCOM2007 Central Administration machine,
and as more applications are installed on servers on the network, the appropriate
management bits are ‘auto-deployed’.

Grab it here –

http://www.microsoft.com/downloads/details.aspx?FamilyId=389FCB89-F4CF-46D7-BC6E-57830D234F91&displaylang=en&displaylang=en

External function calls

External function calls

The latest release of the Rule Manager allows to import external functions into the business vocabulary. As a little exercise I tried to get the current weather condition for a zipcode (maybe I can write some rules if I should bring my umbrella while I leave my house in L.A.)

Initially I intended to call a webservice, but it seems that all free weather webservice calls is something from the past. Yahoo offers weather information as an RSS feed. So a simple XPath query can select the information that I’m interested in:

Here is the code (note the FunctionAttribute decoration on the method)

1 using System.IO;

2 using System.Net;

3 using System.Xml;

4 using AcumenBusiness.IModel;

5 using Type=AcumenBusiness.IModel.Type;

6

7 namespace TestCallWebService

8 {

9 [Concept(“Weather info”, “Try to get weather forecast from different services”)]

10 public class WeatherInfoProvider

11 {

12 private static readonly string YahooWeatherURLFormat = “http://weather.yahooapis.com/forecastrss?p={0}”;

13

14 [Term(“workaround”, “import function requires one field. (bug)”)]

15 private string dummyField;

16 public string DummyField

17 {

18 get { return dummyField; }

19 set { dummyField = value; }

20 }

21

22 [Function(“Get temperature”, “Get the weather info from Yahoo”,

23 ReturnType = Type.text,

24 ArgumentTypes = new Type[] { Type.integer })]

25 public static string GetWeatherInfoAsFeed(int zipCode)

26 {

27 HttpWebRequest request = (HttpWebRequest) WebRequest.Create(string.Format(YahooWeatherURLFormat, zipCode));

28 // execute the request

29 HttpWebResponse response = (HttpWebResponse) request.GetResponse();

30

31 // we will read data via the response stream

32 Stream resStream = response.GetResponseStream();

33 XmlDocument rssFeed = new XmlDocument();

34 rssFeed.Load(resStream);

35

36 //set an XmlNamespaceManager since we have to make explicit namespace searches

37 XmlNamespaceManager xmlnsManager = new System.Xml.XmlNamespaceManager(rssFeed.NameTable);

38 //Add the namespaces used in the xml doc to the XmlNamespaceManager.

39 xmlnsManager.AddNamespace(“yweather”, “http://xml.weather.yahoo.com/ns/rss/1.0”);

40

41 XmlNode weatherCondition = rssFeed.SelectSingleNode(“/rss/channel/item/yweather:condition/@temp”, xmlnsManager);

42 if (weatherCondition != null) {

43 return weatherCondition.Value;

44 }

45 return null;

46 }

47 }

48 }

With the Import Schema adapter I can import this function and call it from my business rules. The coolest part is that you can invoke this from the Interactive Rule Map. So you can see how your rules are executing with this external data. It seems to be 76 fahrenheid in L.A.
Nice weather to jump on the bike and cycle to work…