Jeff Lynch [MVP]

Sponsors

The Lounge

Advertisement

Images in this post missing? We recently lost them in a site migration. We're working to restore these as you read this. Should you need an image in an emergency, please contact us at imagehelp@codebetter.com
BizTalk Server 2004 - Document Normalization

I've decided to update and repost this from 2004 since I've gotten quite a few emails asking about schema generation, document normalization and "industry standard" schemas like cXML, xCBL and PIDX.

In wood-working there is a time honored saying “Measure Twice, Cut Once”. In BizTalk Server 2004, I think the saying should be “Map Twice, Code Once”. I've been working with custom cXML schemas (generated from well-formed sample documents downloaded from the cXML web site) for a vendor integration scenario and have run into the problem of having to map from one complex format to another, even more complex format. The answer turns out to be quite simple but not obvious (hindsight is definitely 20-20). A major supplier to my company has implemented the cXML “OrderRequest” DTD using BizTalk Server 2002 and wanted to receive purchase orders in this format. The cXML DTD was pretty easy to “migrate” to a BizTalk schema using the “Add Generated Items” menu and selecting a well-formed XML sample to use. For those of you not familiar with cXML (which I wasn't until this project), the XML format used is “mixed” (it uses both attributes and elements to hold data) and the generated schema is pretty complex as shown below.


Figure 1: Partial cXML Schema

Mapping from our ERP system's flat-file output to this complex cXML format looked pretty daunting until I decided to use “normalization” to break down the mapping into two steps. First I created a simple internal purchase order XML schema (shown below) that would be used to bridge the gap between a complex flat-file schema and a complex cXML schema.


Figure 2: Simple Internal Schema

Next I created a map from our ERP system's flat-file format to this new internal XML format and placed the map in a custom receive pipeline. This transforms the inbound flat-file into our much simpler internal XML format and publishes it to the MessageBox for further processing. After this, I also created a map from the new internal XML format to the outbound cXML format and placed this map in a custom send pipeline. Now I can write whatever orchestration and/or business rules I need based upon a simple, well-known, internal XML format rather than a complex flat-file or cXML format. The send port then subscribes to this message, transforms it into the required cXML format and sends it to our trading partner. This simple “normalization” technique using maps in the receive and send ports has saved me countless programming hours and is one of the “hidden gems” of BizTalk Server 2004.


Posted 06-25-2005 9:34 PM by Jeff Lynch
Filed under:

[Advertisement]

Comments

Filip wrote re: BizTalk Server 2004 - Document Normalization
on 06-21-2005 1:01 AM
Jeff,

Can you put the the cxml schemas you generated online? I can't seem to convert the dtd's into xsd's using BTS 2004?

Thanks.

Filip
Jeff Lynch wrote re: BizTalk Server 2004 - Document Normalization
on 06-27-2005 6:22 AM
For some reason the new version of the cXML DTDs will not convert into an XSD using BTS2004 although the prior version works just fine. You can use the sample files included with the cXML download to generate xsd schemas just as I did.
J.P wrote re: BizTalk Server 2004 - Document Normalization
on 06-29-2005 12:01 AM
Hi Jeff,
I am currently doing exactly what you have accomplished with cXMl. I have gotten the schemas into biztalk (it was an experience) but my problem is with my custom pipeline component. The file i receive is also flat and I have created an xsl which splits it into the desired format. The error i am receiving is " The assembler cannot retrieve document specification by using this type:<Namespace of document>". Is there something I am missing in the execute method of IComponent?
Jeff Lynch wrote re: BizTalk Server 2004 - Document Normalization
on 06-29-2005 11:08 AM
I'd recommend posting your issue to the microsoft.public.biztalk newsgroups along with your schema and map. Or just send me an email via my blog with the attachments and I'll look it over!
J.P wrote re: BizTalk Server 2004 - Document Normalization
on 06-29-2005 4:27 PM
Hi Jeff, I must be looking in the wrong spot because I cant seem to find where to attach my files to.
Jeff Lynch wrote re: BizTalk Server 2004 - Document Normalization
on 06-30-2005 5:59 AM
Sorry JP. Mental slip. Send me your schemas and map to jtlynch@nospamhouston.rr.com and remove the nospam. I'll look them over and get right back to you.
J.P wrote re: BizTalk Server 2004 - Document Normalization
on 06-30-2005 6:12 PM
Hi Jeff, thanks for your response, however I have sorted it out. I had an xml assembler before my custom pipeline component in the pipeline design view and this was causing the problems.
Well onto the next exciting part of mapping all that cXml data..

Thanks
John P

Add a Comment

(required)  
(optional)
(required)  
Remember Me?