BizTalk solves a lot of problems, but with it comes a whole other bag of fun new ones to solve. Oh joy. All kidding aside I have been facing some real challenges working with cXML in BizTalk due to the nature of the cXML standard. Primarily the fact that cXML does not use XSD’s to describe itself and instead uses a DTD. BizTalk does not like DTD’s, as in, if you send a document to BizTalk with a DTD using the standard XML Pipeline, it will fail.
BizTalk also doesn’t work well if you try sending it messages that don’t have an XML Namespace because BizTalk uses the Namespace and the root node of the XML document to identify the message inside the system. So I have to inject something like xmlns=”http://something” into the root node as well.
Some solutions have been documented but I ran into other issues and ended up the solution a little further. Long story short, I ended up creating a custom Pipeline Component to strip out DTD’s and add Namespaces using regular expressions. At first I created a cXML cleaner component that worked specifically for my scenario. This worked fine but eventually I noticed that I was using a regular expression to find and replace the DTD which led me to think “Why can’t I use any regex I pass in and replace anything I want to?” So I did. I even made it open source so no one ever has to feel the anguish of having to develop custom BizTalk Pipeline Components, because it sucks. Bad.
Feel free to pull it down and give it whirl. If you improve it, by all means, send me a patch and I’ll include it in the trunk.
RegexReplace on Google Code
Screenshots:
1. Use Multiple RegexReplace in a single stage to process a document multiple times.
2. Simply set the Pattern and the Replacement string.
Home
© Rapidparts, Inc 2008 | 2950 Walkent Ct. NW, Grand Rapids, MI 49544 | Phone 616.647.2500 | info@rpionline.com