BAM, BizTalk

Trouble with Excel automation in a non-English locale

Deploying BAM definitions from Excel files means automating Excel. Automating Excel has it’s issues when you work in a multilingual environment, like me. Specifically, when you use a non-English locale for your OS while having an English localized version of Excel installed may cause you to get the exception: 
ERROR: Failed to open BAM Excel workbook file – ‘C:Xxx.xls’.
Old format or invalid type library.

I always use the English versions of applications, and the Office 2007 Suite is no exception. This problem isn’t new, but it’s still with us. According to the KB that deals with this issue there are three possible solutions.




  1. Set the locale in the application doing the automation to English


  2. Set your environments (OS) locale to English



Option one isn’t really an option in this case since it’s bm.exe doing the automation. Option two isn’t really something you’d want in the long run, but it’s ok if you just need it as a temporary workaround during deployment. Option three – getting a language pack is really the preferred one and if you’re a MSDN Subscriber like me, the language packs are just a few clicks away. For the rest of you, sorry, you’ll have to buy them (they are $24.95 at the moment).

BizTalk, General, Swedish

Nystart för BizTalk Usergroup Sweden

Det är med nöje jag kan tillkännage…





Nystart för BizTalk Usergroup Sweden


 


Målet med BizTalk Usergroup Sweden är att genom en community driven insats öka förståelsen och kunskapen kring Microsofts produkter och lösningar från Connected Systems Division, främst kring varumärket BizTalk och närliggande. Information kommer att förmedlas främst genom presentationer och demo, genomförda av såväl frivilliga bland deltagarna själva som av speciellt inbjudna erkända svenska och internationella talare och experter. Det kommer även att finnas utrymme för andra typer av evenemang.


 


Målgruppen är individer med teknisk bakgrund eller intresse, såväl från linje som från konsultorganisationer, intresserade av systemintegration på Microsoft plattformen.


 


Vår målsättning är initialt att vi ska ha ett möte ungefär varannan månad.


 


Vår första träff kommer att gå av stapeln den 12:e februari, där innehållet i ESB Guidance och nyheterna kring Oslo kommer vara fokus.


                      


Agenda för kvällen är som följer:


17:45             Samling


18:00             Start


                      Introduktion till Usergroupen och dess arbete


                      ESB Guidance (Mikael Håkansson och Johan Hedberg)


19:00             Paus, mingel, diskussioner. Något att äta och dricka kommer finnas.


19:30             ESB Guidance avslutas


                      Oslo (Alan Smith)


Q & A, avrundning, diskussioner


 


Vi kommer att hålla till i KnowITs lokaler på Klarabergsgatan 60. Tack vare att antalet platser är begränsade och att mat ska planeras vill vi ha ditt svar senast den 31:a januari till bugs.info@gmail.com.


 

Oslo är en samling tekniska lösningar som ska förenkla byggandet av applikationer för en tjänsteorienterad arkitektur. Med Oslo förflyttar vi oss från att modeller beskriver applikationer till att modellen är applikationen. Läs mer på http://www.microsoft.com/soa/products/oslo.aspx.

 

ESB Guidance är ett steg i riktningen att lyfta BizTalk till mer av en Enterprise Service Bus (ESB) med utökat stöd för löst kopplade tjänster. Läs mer på http://msdn2.microsoft.com/en-us/library/bb931189.aspx. Presentationen kommer belysa hur BizTalk relaterar till SOA, SOI och inte minst ESB. Vi kommer gå igenom stöd, riktlinjer, komponenter och tillhörande portal, och ge en bild av hur ESB Guidance kan konfigureras, användas och utökas.

BizTalk, Pipeline Components

Removing Xml Namespace in a pipeline component

Richard Hallgren recently blogged about how to remove Xml namespaces from Xml documents, as has Kirk Allen Evans earlier here and here. While the latter writes from a general .NET and ASP.NET perspective Richard’s post is from a BizTalk perspective and in his post he asks for alternative ways, other then the ways he is presenting, of doing it. 


The root issue is how do I turn

<ns0:Blah xmlns:ns0=”http://RemoveXmlNamespace.BTS.BlahMessage”>

into

<Blah>


First of all, let me just say that I understand namespace and I don’t think they should be removed if at all avoidable. This is not my first choice of a solution, as it probably isn’t for anyone working with BizTalk. The fact remains though that in some cases it still turns out to be necessary. My option of doing this would then be by using a pipeline component and the classes available to us from Microsoft.BizTalk.Streaming.dll. My main reason for this is performance. I would really hate to have to keep either the source document or the resulting document in memory using XmlDocument and MemoryStream like the XslTransform pipeline component sample from the BizTalk Server 2006 SDK does. I’m pretty certain that particular sample can be enhanced using XPathDocument, XslCompiledTransform and VirtualStream (to keep down the impact on memory) but it still isn’t as good if your only purpose is removing the namespace. That sample can however do many other things that my option can’t, since it does an XslTransform and this doesn’t.


So using the streaming classes in general and XmlTranslatorStream in particular we can override some of it’s methods to create a streaming xsl transformation doing what we want. The resulting code is suprisingly simple. Here is the Execute method:

public Microsoft.BizTalk.Message.Interop.IBaseMessage Execute(
IPipelineContext pContext,
Microsoft.BizTalk.Message.Interop.IBaseMessage pInMsg)
{
pInMsg.BodyPart.Data = new XmlNamespaceRemoverStream(
pInMsg.BodyPart.GetOriginalDataStream());
return pInMsg;
}

And here is the class that does the actual work (although as you can see it doesn’t really do much):

public class XmlNamespaceRemoverStream : XmlTranslatorStream
{
protected override void TranslateStartElement(
string prefix, string localName, string nsURI)
{
base.TranslateStartElement(null, localName, null);
}

protected override void TranslateAttribute()
{
if (this.m_reader.Prefix != “xmlns”)
base.TranslateAttribute();
}

public XmlNamespaceRemoverStream(Stream input)
: base(new XmlTextReader(input), Encoding.Default)
{ }
}


This sample is available for download: removexmlnamespacepipeline.zip.

BizTalk, General

Grab BizTalk Hotrod to start of the new year

The free online magazine BizTalk Hotrod has been published again, this time we are looking at issue number three. It contains more then ever, and the size of the download shows it. The PDF weighs in at just over 18MB! Supposedly the size is also attributed to the fact that you will now also be able to see the content of all images and read the sourcecode contained there-in, which was my only problem with the previous issues. Go get it (links directly to the PDF). In case you haven’t read the past two issues, those are well worth your time as well.

BizTalk, Pipeline Components

Consuming Pipeline Component issue fixed in R2

I previously experienced an issue with a general purpose (not an assembler/disassembler) consuming pipeline component in BizTalk Server 2006. For those of you unfamilliar with the term a consuming pipeline component is just that, a component that consumes the messages and returns null to stop pipline and message processing. Having tested this on R2 I’m happy to report that this issue doesn’t exist any more.


In short, my previous issue was that in some situations a consuming pipeline component might cause an endless loop to occur within BizTalk, which in any scenario is undesirerable. The cause of this was if the pipeline threw an exception making the message become suspended on the first time around, and then returned null the second time around. Granted, not a very common scenario, so chances are good that it might not have happened to you.


This code in the execute method of the pipeline component would allow you to reproduce the error:

public IBaseMessage Execute(IPipelineContext pContext, IBaseMessage pInMsg)
{
if (pInMsg.MessageID != new Guid((string)pInMsg.Context.Read(
“InterchangeID”, “http://schemas.microsoft.com/BizTalk/2003/system-properties”)))
{
System.Diagnostics.Trace.WriteLine(“EndLess: Return null”);
return null; // resume, return null
}
else
{
System.Diagnostics.Trace.WriteLine(“Ex”);
throw new Exception(“First time in pipeline, throwing exception”);
}
return pInMsg;
}

Just stick this code in the appropriate place in the custom pipeline component, create a receive pipeline, and run a message though. First time around it will get suspended. Now go ahead and resume it. Wham! There you go – endless loop in 2006. However like I said, R2 does not display this behavior, and with any luck some hotfix or update for 2006 might contain the fix as well.


The code above also shows another small trick: How to know if a message is a resume in a receive pipeline. When a message is first received the MessageID and InterchangeID are the same, however on a receive the MessageID will be a new one, but the InterchangeID will remain the same as it was the first time.