.NET 3.5, BizTalk Server 2009, Development, SOA, WCF

Oh BizTalk, why dost thou mock me?

In any given integration project many different parties are involved. In some cases these parties have standard endpoints against which BizTalk operates and sometimes these endpoints are built as you go in the participating systems to meet a new demand. This is true for other types of projects as well – things get finished at different times – and you need to be able to work independent of each other during that time. What you often do determine very early in the project are the design of messages, schemas or APIs through which you exchange information. In many cases a BizTalk project can effectively use FILE send or receive ports that serve the same purpose as a One-Way send or receive port to say SAP would do at a later stage. But how about solicit-response send ports? What do you exchange these for?


In this post I’d like to introduce a way to handle solicit-response through the use of a catch all WCF Service. There any many ways in which to mock a service. The prime benefit with this approach is that you will be able to model your BizTalk solution the way you want it to be, without having to have access to the real service, and exchange the solicit-response port for it’s production or acceptance test counter parts at your convenience.


To achieve this we need something that let’s us send in any message, and based on some part of the message determine what message to send back, and the send it as a response.


WCF is a perfect candidate. It has functionality both to allow us to create methods that handles all incoming requests by specifying a wildcard (*) as the Action property, and accept any message and can send any message as a return. Using the Message base class it also allows us to easily create the response message, and populate the body of the message from the contents of a stream, such as a file (See the ‘Creating Messages from XmlReaders’ topic in the link).


So what I did was I created a WCF Service, and added a method to catch all messages:

[OperationContract(Action = “*“, ReplyAction=”*“)]
Message CatchAll(Message message);

In the implementation for this method I have include the following code:

FileStream stream = new FileStream(ResponseHelper.GetResponseFile(requestAction), FileMode.Open);
XmlDictionaryReader xdr = XmlDictionaryReader.CreateTextReader(stream, new XmlDictionaryReaderQuotas());
MessageVersion ver = OperationContext.Current.IncomingMessageVersion;
return Message.CreateMessage(ver, ResponseHelper.GetResponseAction(requestAction), xdr);

I have a small helper class that just helps me get data from the config, the config in turn looks like this:

<configSections>
  <section name=”requestResponseHandling
type=”ServiceHost.RequestResponseHandlingConfigSection, ServiceHost“/>
</configSections>
<requestResponseHandling>
  <actionList>
    <add requestAction=”http://tempuri.org/IService1/GetData2
responseAction=”http://tempuri.org/IService1/GetData2Response
responseLocation=”GetData2Response.xml” />
  </actionList>
</requestResponseHandling>

This enables me to add new responses to incoming requests without needing to rebuild the service to incorporate a new response. You could go crazy here with code and undertakings to reply based on some context or what not. In the case presented here I’m just making it simple and returning the same static message for all request that matches a certain requestAction.


Finally, put this in the host of your choice. In my case I’ve got IIS so I’m hosting it there. That will also cause changes to the web.config to automatically get loaded, so that’s happy times.


Using this from a client is super easy. Just point the address of the client endpoint towards this service instead. The only thing that might not be super simple (though still fairly simple) is that you need to know what the meat of the response will look like when serialized as a response (the body of the response message). That is you need to Generate a sample response message from your wsdl.


Now let’s look at how we can utilize this to mock services in BizTalk Server. Oh, but wait, that sounds like it would be a bit of work to do, but… no, that isn’t the case. In fact, once you have configured the WCF service the only thing you need to do is to point your Send port at this service instead of the system that would otherwise be there in it’s place. Loop closed.

BizTalk Server 2009, Download, VirtualPC

BizTalk Server 2009 VPC

Available. Usable for demos, Hands-On labs and just getting a peak at BizTalk Server 2009 if you aren’t yet running it. Good news. Get it here.


Update 1 [2009-10-19]: This download is currently corrupt. Fix pending.
Update 2 [2009-10-24]: The download page has been removed. Links to files still work. Files still corrupt AFAIK.
Update 3 [2009-10-25]: Download is live again! Files are still corrupt.
Update 4 [2009-10-30]: I’ve download it 5 times. Still corrupt. Some people in other parts of the world seem to be able to download it ok, while others in the same country gets it corrupt. Cached somewhere?
Update 5 (2009-11-02): Got a question from a blog reader that downloaded the file today and found it corrupt if I had heard when a fix was comming. I haven’t.
Update 6 (2009-11-04): I’ve had multiple reports of people downloading the file, both those finding it corrupt and those who are able to use it ok. Try it if you have the bandwidth to spare. I haven’t been able to pinpoint any determining factor, though I do so hate things that are down to chance.


Update: Here are the links directly to the files, for loading in FDM or similiar.


Part 1
Part 2
Part 3
Part 4
Part 5
Part 6
Part 7
Part 8

64-bit, Administration, BizTalk Server 2009, Installation

BizTalk Server 2009 Installation Errors

I just thought I’d mention these install errors since I’ve gotten them now on several occasion when installing BizTalk Server 2009 Enterprise 64-bit Single Sign On Master Secret Server on Windows Server 2008 and SQL Server 2008 (although I doubt the last one has any role in these errors).

This page describes the procedure of Installing and Clustering the Enterprise SSO Master Secret Server, although it mentions nothing about these specific peculiarities.

Error1

Log

[10:03:05 Error] Setup runtime files for AMD64 platform: Fatal error during installation.
[10:03:05 Info] Marking Stage: Install/Installing components as Completed in TaskInfo XML
[10:03:05 Info] ReadTaskInfoXML: Attempting to load TaskInfo xml from string
[10:03:15 Info] Showing MessageBox with text: The following platform components failed to install and will need to be manually installed before setup can proceed: Setup runtime files for AMD64 platform: Fatal error during installation. Check the log for details. Return Code: 1

MSI (s) (8C:FC) [10:03:04:688]: Product: Microsoft BizTalk Server Setup Bootstrap Files (x64) — Error 1310. Error writing to file: atl90.dll. System error 0. Verify that you have access to that directory.
Error 1310. Error writing to file: atl90.dll. System error 0. Verify that you have access to that directory.
Action ended 10:03:04: InstallFinalize. Return value 3.
Action ended 10:03:05: INSTALL. Return value 3.
MSI (s) (8C:FC) [10:03:05:867]: Product: Microsoft BizTalk Server Setup Bootstrap Files (x64) — Installation failed.
MSI (s) (8C:FC) [10:03:05:868]: Windows Installer installed the product. Product Name: Microsoft BizTalk Server Setup Bootstrap Files (x64). Product Version: 3.8.368.0. Product Language: 1033. Installation success or error status: 1603.

Resolution

I have received this error if I connected to the server using Remote Desktop/Microsoft Terminal Service Client without using the /admin flag (former /console flag). Read more here.

Error2

Log

[10:34:48 Info] Showing MessageBox with text: The following platform components failed to install and will need to be manually installed before setup can proceed: Enterprise Single Sign-On Server: Unspecified error Check the log for details. Return Code: 1

[10:34:35 Info] Error 1928.Error registering COM+ application. Please ensure that DTC is enabled. Contact your support personnel for more information.
[10:34:35 Info] Showing MessageBox with text: Error 1928.Error registering COM+ application. Please ensure that DTC is enabled. Contact your support personnel for more information. Return Code: 0
[10:34:35 Info] Action 10:34:35: Rollback. Rolling back action:
[10:34:39 Info] Detailed Log information for product D:InstallBiztalk 2009PlatformSSO64SSO64.msi is available at <a href="C:UsersxxxAppDataLocalSetup(072909 103411).log">DetailedLog</a>
[10:34:39 Info] MSI installation returned 1603 – Fatal error during installation.
[10:34:39 Error] Error 1928 occurred during MSI installation.
[10:34:39 Error] Action 10:34:30: InstallComplus.8E665C9D_5561_45FC_AAA0_3878B87F3B86. Installing COM+ components
[10:34:39 Error] Error 1928.Error registering COM+ application. Please ensure that DTC is enabled. Contact your support personnel for more information.
[10:34:39 Error] c:depotsetupv2privatecommonsetupwizardexesetup.cpp(1670): FAILED hr = 80004005

Resolution

This error has occurred in clustered environments when the clustered instance of MSDTC was not active on the node on which the installation was taking place. Failover the MSDTC to the current node that installation is to be run on and try again.

BizTalk Server 2009, Learning, SOA

Book Review: SOA Patterns with BizTalk Server 2009

Richard Seroter has a style of writing that’s… entertaining and easy to read. Some books or articles have a tendency to go on and on without really saying too much. Let me assure you, that’s not the case here. You can find that in his blog as well.

If after reading the book I would be asked to identify an audience for the book I would indicate that the people that would get the most value out of reading the book are the ones that are already familiar with BizTalk. You don’t have to be familiar with WCF, as I think it does a good job of explaining it down to a level where you can follow things being said thereafter. Again though, I would suggest that you will also get the most value out of the book if you are already familiar with the concepts of WCF. And it’s for developers, not administrators. From the BizTalk books I’ve read, there are really none dedicated to administrators, although most contain parts meant for administrators. This does not.

I understand why it contains introductory chapters of BizTalk – you don’t want to alienate a large segment of people. But… in my humble opinion, beginners will get more value out of reading Professional BizTalk Server 2006 first. This is not a beginners book.

I read it cover to cover, that’s how I read most books, but if you belong to what I would claim is the best target group to get this book, you will read the first three chapters quickly, or not at all. Don’t get me wrong, they are not poorly written in any way, on the contrary, but you probably know this stuff well enough anyway. The mother of all learning is repetition though so…

I would say that the next five chapters (4-8, pg 87-276) is the meat of the book. Even though you know BizTalk (and there really aren’t all that many people in my cultural part of the world that say they really know something), I believe everyone can pick up a thing or two, or at the very least be reminded of things you should do when building solutions in BizTalk Server. I would also claim that these things, although arguably more important in a SOA, are of interest to all BizTalk developers, regardless if you are using BizTalk to do EAI, SOA or ESB style development – although the focus of the book might be on SOA and WCF.

The following chapter on the WCF SQL Server Adapter is a really good read as well, and one of the few resources available explaining the new SQL Adapter in any depth. I mostly recommend reading the book from start to finish, but starting with chapter 9, the chapters 9-12 can be read independently from each other and the rest of the book. Although chapter 9 is called “New SOA Capabilities in BizTalk Server 2009: WCF SQL Server Adapter”, it is mostly applicable on BizTalk Server 2006 R2, as is most of the book. Some parts of the chapter covers SQL Server 2008 specific functionality though.

The next couple of chapters (10, 11) are BizTalk Server 2009 specific, but they are the only ones. You can get this book even if you do BizTalk Server 2006 R2 development today and in the foreseeable future. The last chapters (11-12) are about coming functionality. It’s always difficult to write stuff about the future (or pre-release software for that matter), since inevitably, it’s constantly changing based on actions in the present (kinda deep huh?), but it gives a good glimpse into how things stood at the writing of the book (and in the majority of cases still does).

Summing up my experiences I think that an alternative title that reflects my above thoughts could have been Advanced or Pro WCF in BizTalk Server 2006 R2 (following in line with Apress names of Pro Mapping/BAM/EDI/RFID/… – but SOA Patterns with BizTalk Server 2009 is so much cooler 😉 (and is just as appropriate)

To close, I highly recommend this book for anyone doing BizTalk development, specifically those matching the right crowd as described above.

Also BizTalk User Group Sweden looks forward to Richards visit in September when he will be speaking on some of these topics and beyond.

Additional links:

Administration, BizTalk Server 2009, Development, Presentation, Usergroup, Webcast

April post-swebug-event resources, part 1

Slides for last wednesdays session with Brian Loesgen and Alan Smith – Development & Administration Best Practices are available through the BizTalk User Group Sweden site here. Check the lower right corner downloads.


UPDATE: Video available here and here.


We used a customized version of the floatzam application and took some pictures of people as they arrived and had tweets, rss and flickr pictures appear on screen live during the period leading up to event starting. All good fun. Not too many saw it though.


image


I will updates this post when the videos are uploaded to channel9.


Meanwhile, here are some pictures from wednesdays and thursdays events.


Flickr:
http://www.flickr.com/photos/37233849@N02/


Twitpic.
http://twitpic.com/3emkg
http://twitpic.com/3cp62
http://twitpic.com/3elog