by community-syndication | Dec 20, 2007 | BizTalk Community Blogs via Syndication
Sudhir Hasbe recently came on board the RFID team as a Product Manager. In his brief time on the team, Sudhir has been doing a bit of everything from working behind the scenes at EPC Connections, delivering the keynote at RFID Journal Live Europe, putting…(read more)
by Richard | Dec 20, 2007 | BizTalk Community Blogs via Syndication
Whoho! I’ll be speaking at Developer Summit 2008. Developer Summit is a conference hosted by Cornerstone, it’s being held in Stockholm between the 9th and 11th of April 2008.
I’ll be doing a talk on Master Data Management (MDM) for the Enterprise using BizTalk 2006. Basically I’ll present some basic theory behind the MDM concept and how it relates to SOA. Then I’ll relate all that to a customer case I recently worked on solving a MDM requirement. Finally I’ll be showing a short demo where I publish some Master Data and update all subscribers to it. In the same demo I’ll also demonstrate on how to monitor the process using Business Activity Monitoring.
Sound interesting? Something specific you think should be in the presentation? Let me know!
Hope to see you there!
by Richard | Dec 20, 2007 | BizTalk Community Blogs via Syndication
Way to often I get a request to deliver a message from BizTalk without any XML namespace. Comments like the one below aren’t that rare.
>
> Why do you put those “ns0” I front of every tag!? We can’t read the XML when it’s written like that! All our XPath and XSLT seems to fail.
>
>
>
> We don’t want _****_ … We expect the messages from you to be like _****_ …
>
>
>
> Is that some BizTalk specific?
>
>
I always try to explain what XML namespaces are, and why it’s a good idea to use them (especially when it comes to versioning of messages). Sometimes it’s just impossible to get people to understand the advantages of using it and to persuade them to change their solutions to handle XML namespaces. It’s in these cases it’ll be up to the implementation in BizTalk to remove the namespace.
How to remove XML namespace
There are a couple of ways of achieving this, we can use .NET code that we call in a pipeline or in an orchestration. But we can also handle this using XSL – and that’s what I’ll show in this post. The XSL stylesheet below will remove all XML namespaces while transforming the message. Basically it just copies the nodes, attributes and it’s values using the local-name() function to ignore the XML namespaces.
<div><span style="color: #0000ff"><?</span><span style="color: #ff00ff">xml version="1.0" encoding="utf-8"</span><span style="color: #0000ff">?></span><span style="color: #000000">
</span><span style="color: #0000ff"><</span><span style="color: #800000">xsl:stylesheet </span><span style="color: #ff0000">version</span><span style="color: #0000ff">="1.0"</span><span style="color: #ff0000">
xmlns:xsl</span><span style="color: #0000ff">="http://www.w3.org/1999/XSL/Transform"</span><span style="color: #0000ff">></span><span style="color: #000000">
</span><span style="color: #0000ff"><</span><span style="color: #800000">xsl:template </span><span style="color: #ff0000">match</span><span style="color: #0000ff">="/"</span><span style="color: #0000ff">></span><span style="color: #000000">
</span><span style="color: #0000ff"><</span><span style="color: #800000">xsl:copy</span><span style="color: #0000ff">></span><span style="color: #000000">
</span><span style="color: #0000ff"><</span><span style="color: #800000">xsl:apply-templates </span><span style="color: #0000ff">/></span><span style="color: #000000">
</span><span style="color: #0000ff"></</span><span style="color: #800000">xsl:copy</span><span style="color: #0000ff">></span><span style="color: #000000">
</span><span style="color: #0000ff"></</span><span style="color: #800000">xsl:template</span><span style="color: #0000ff">></span><span style="color: #000000">
</span><span style="color: #0000ff"><</span><span style="color: #800000">xsl:template </span><span style="color: #ff0000">match</span><span style="color: #0000ff">="*"</span><span style="color: #0000ff">></span><span style="color: #000000">
</span><span style="color: #0000ff"><</span><span style="color: #800000">xsl:element </span><span style="color: #ff0000">name</span><span style="color: #0000ff">="{local-name()}"</span><span style="color: #0000ff">></span><span style="color: #000000">
</span><span style="color: #0000ff"><</span><span style="color: #800000">xsl:apply-templates </span><span style="color: #ff0000">select</span><span style="color: #0000ff">="@* | node()"</span><span style="color: #ff0000"> </span><span style="color: #0000ff">/></span><span style="color: #000000">
</span><span style="color: #0000ff"></</span><span style="color: #800000">xsl:element</span><span style="color: #0000ff">></span><span style="color: #000000">
</span><span style="color: #0000ff"></</span><span style="color: #800000">xsl:template</span><span style="color: #0000ff">></span><span style="color: #000000">
</span><span style="color: #0000ff"><</span><span style="color: #800000">xsl:template </span><span style="color: #ff0000">match</span><span style="color: #0000ff">="@*"</span><span style="color: #0000ff">></span><span style="color: #000000">
</span><span style="color: #0000ff"><</span><span style="color: #800000">xsl:attribute </span><span style="color: #ff0000">name</span><span style="color: #0000ff">="{local-name()}"</span><span style="color: #0000ff">></span><span style="color: #000000">
</span><span style="color: #0000ff"><</span><span style="color: #800000">xsl:value-of </span><span style="color: #ff0000">select</span><span style="color: #0000ff">="."</span><span style="color: #ff0000"></span><span style="color: #0000ff">/></span><span style="color: #000000"></span>
<span style="color: #0000ff"></</span><span style="color: #800000">xsl:attribute</span><span style="color: #0000ff">></span><span style="color: #000000">
</span><span style="color: #0000ff"></</span><span style="color: #800000">xsl:template</span><span style="color: #0000ff">></span><span style="color: #000000">
</span><span style="color: #0000ff"><</span><span style="color: #800000">xsl:template </span><span style="color: #ff0000">match</span><span style="color: #0000ff">="text() | processing-instruction() | comment()"</span><span style="color: #0000ff">></span><span style="color: #000000">
</span><span style="color: #0000ff"><</span><span style="color: #800000">xsl:copy </span><span style="color: #0000ff">/></span><span style="color: #000000">
</span><span style="color: #0000ff"></</span><span style="color: #800000">xsl:template</span><span style="color: #0000ff">></span><span style="color: #000000">
</span><span style="color: #0000ff"></</span><span style="color: #800000">xsl:stylesheet</span><span style="color: #0000ff">></span></div>
Apply the XSL transformation
We can use this XSL stylesheet in a ordinary BizTalk map on the send port using the Custom XSL Path property in the BizTalk Mapper. The result is that the XSL we usually generate in the mapping tool will be overridden by our own XSL stylesheet. The figure below shows how we use the property windows of the grid in the BizTalk Mapper to set the property and point the Mapper to our XSLT document.
But what if we already have a map on the send port and it’s that already transformed message we like to remove the namespace from? One possibility is to use the XSLT Transform pipeline component that comes with the BizTalk 2006 SDK. It’s usually located at C:Program FilesMicrosoft BizTalk Server 2006SDKSamplesPipelinesXslTransformComponentXslTransform on your development machine. I’ve written about this sample component before here were I used it another scenario.
The figure below shows how we use the property windows of the XSLT Transform Component in a pipeline in the Pipeline designer tool to set the path to our XSLT stylesheet.
Final thoughts
The XSLT Transform component is far from perfect and the obvious problem is of course that the component loads the whole message into memory using the XmlDocument class to read the message. That means that this solution isn’t for those scenarios where you’ll have huge messages coming in by the thousands. But for those cases where you have normal sized messages and you have a idea of the traffic you receive, it’s a quick and easy solution.
Any comments on the pro and cons on this solution and how you usually solve this scenario will be appreciated!
>
> **UPDATE #1: **Make sure you don’t miss [Johan Hedbergs solution](http://blogical.se/blogs/johan/archive/2008/01/07/removing-xml-namespace-in-a-pipeline-component.aspx) to this problem. Basically he solved it using the [Microsoft.BizTalk.Streaming.dll](http://technet.microsoft.com/en-us/library/microsoft.biztalk.streaming.aspx) which will give you better memory management.
>
>
>
> **UPDATE #2: **Based on the comments to this post I’ve posted an “updated” post [here](http://www.richardhallgren.com/removing-xml-namespaces-revisit/) solving this using ordinary mapping and defining a schema without a XML namespace – easier and more correct.
>
>
by community-syndication | Dec 20, 2007 | BizTalk Community Blogs via Syndication
Whoho! I’ll be speaking at Developer Summit 2008. Developer Summit is a conference hosted by Cornerstone, it’s being held in Stockholm between the 9th and 11th of April 2008.
I’ll be doing a talk on Master Data Management (MDM) for the Enterprise using BizTalk 2006. Basically I’ll present some basic theory behind the MDM concept […]
by community-syndication | Dec 19, 2007 | BizTalk Community Blogs via Syndication
Microsoft have rounded up all the serious BizTalk Bloggers (MVPs + keen MS guys +
Teams) and the Connected Systems Division (CSD Team) within Microsoft and produced a
valuable aggregator with all this in one spot.
Just have a look at the bloggers that are contributing to this – sensational!!! One
stop shop for you guys.
From WCF to BizTalk, EDI + Custom Pipelines.
We all display this logo on our site.
Here’s the RSS Feed http://biztalkblogs.com/RssDoc.xml
Merry Christmas!!!!!
by community-syndication | Dec 19, 2007 | BizTalk Community Blogs via Syndication
Stephen Thomas hit me up to write an article for his newsletter (if you aren’t automatically getting it, you should sign up for it here).
I wrote about how to automatically uninstall a BAM definition as part of the MSI uninstall. You can read about it here: http://www.biztalkgurus.com/newsletter/TheBizTalker-Volume-11.html
The one dilemma I have is that I cannot seem to figure out how to get a batch script to resolve the installation path by using this code in a batch script:
for /f “skip=2 tokens=2,*” %%a in (‘reg query “HKLM\SOFTWARE\Microsoft\BizTalk Server\3.0” /v “InstallPath”‘) do SET BTSbm=”%%~bTracking\bm.exe remove-all -DefinitionFile:”
I am looking into it and will update this blog entry when I finally do figure it out.
by community-syndication | Dec 19, 2007 | BizTalk Community Blogs via Syndication
As you’ve undoubtedly noticed, I’ve begun to do more video as part of the blog over
the last several weeks. As part of this experiment, I’ve started recording interviews
with several people I’ve met along my travels. This series will be called “Who
are you? What do you do?” and each time will be a one on one with someone I’ve met
answering those two questions, and sometimes a few more. For the first installment,
I present Dustin Hicks, Microsoft TS for BizTalk Server in the South Central district.
Tim Rayburn is a consultant for Sogeti in the Dallas/Fort
Worth market.
by community-syndication | Dec 18, 2007 | BizTalk Community Blogs via Syndication
It’s been just about a year since I left Microsoft to take my current job, and after some success in my initial role, I’m switching teams and responsibilities.
I was brought into this company to help establish our BizTalk practice. After participating in 10 projects, teaching 8 classes (to 110+ colleagues), creating a few tools and […]
by community-syndication | Dec 18, 2007 | BizTalk Community Blogs via Syndication
For HIPAA documents with equivalent subloops and/or equivalent segments (such as 837 claim documents) the EDI engine in BizTalk Server 2006 R2 would incorrectly generate validation errors when these loops and/or segments were not in the same order as they were in the schema. The HIPAA standard allows equivalent subloops and segments to appear in […]
by community-syndication | Dec 18, 2007 | BizTalk Community Blogs via Syndication
I run this blog on a virtual Gentoo Linux server and during some routines updates the other night I managed to balk the environment, so much so that I needed to reimage the machine and start again from scratch. Its taken me a while to get back up and running (including moving from Gentoo to […]