Eric’s BizTalk 2004/2006 Blog

My BizTalk Experiences using Flat Files, InfoPath, BAM, BRE, BAS, HL7, HIPAA, WSS.

March 30, 2006

XML Reusability

Filed under: BizTalk — eric @ 11:51 pm

Here are the instructions on how to create xml objects and then reuse them in a different schema.

  1. Create your object that you want to reuse in a schema
  2. In the properties of the object, type in objectType in the Data Structure Type
  3. Create your ‘real’ schema and in the Schema node’s properties, click the elipse on Imports and browse to the schema defined in Step 1
  4. Create the real object and in the Data Structure Type, choose the complex type that was created in Step 2

The following example shows how to do it.

March 27, 2006

HL7 Accelerator and v2.5

Filed under: BizTalk, HL7 — eric @ 2:10 pm

I just recieved word that the HL7 accelerator (v1.0) and the v2.5 schemas do not mix (because they don’t exist I guess).

Here is what I recieved from support:

HL7 v2.5 and v2.6 schemas were not included with the RTM of the HL7 v1.3 Accelerator.  This will be included in an out-of-band feature pack (no release date). 

March 24, 2006

BizTalk Tidbits

Filed under: BAM, BizTalk, BRE — eric @ 9:13 am

I have a bunch of tidbits that I have found, and instead of creating a blog entry for each of them, I have put them all together into one big entry. I hope that there is something in this for everyone! 

Items Explained:
1. Using the Flat File Schema you can define custom date formats. One word of caution, in order to use this feature, you have to guarantee that the date is going to be present.
 

 

2. Using XPath, you can take advantage of features of XPath, namely count(), substring-before(), substring-after() and all other available XPath functions. Example:

MessageCount=(System.Int32)xpath(CompleteMsg,”count(/*[local-name()=’File’ and namespace-uri()=’http://AppendExample.File’]/*[local-name()=’Record’ and namespace-uri()=’http://AppendExample.Record’])”);

And

FirstName=xpath(IndividualMsg.BodyPart,”substring-before(/*[local-name()=’Record’ and namespace-uri()=’http://AppendExample.Record’]/*[local-name()=’Information’ and namespace-uri()='’]/@*[local-name()=’Name’ and namespace-uri()='’],’ ‘)”);

LastName=xpath(IndividualMsg.BodyPart,”substring-after(/*[local-name()=’Record’ and namespace-uri()=’http://AppendExample.Record’]/*[local-name()=’Information’ and namespace-uri()='’]/@*[local-name()=’Name’ and namespace-uri()='’],’ ‘)”);

3. Since there is no such thing as an Envelope Schema that can be used in a Flat File scenario, you can use XPath to extract internally the separate documents and manipulate the data as needed. Example:

xpathString=System.String.Format(”/*[local-name()=’File’ and namespace-uri()=’http://AppendExample.File’]/*[local-name()=’Record’ and namespace-uri()=’http://AppendExample.Record’][{0}]”,CurrentRecord);

tempXML=new System.Xml.XmlDocument();

tempXML=xpath(CompleteMsg,xpathString);

4. You don’t need to have a Construct Shape with an internal Message Assignment Shape, you can simply use the Construct Keyword; you can construct multiple messages at the same time. Example:                                    

construct AfterMsg,BeforeMsg
{
   AfterMsg=tempAfterXML;
   BeforeMsg=tempBeforeXML;
}

One word of caution though, if you are using the Tracking Profile Editor to capture data, it will not show as an option, so use this only if you are not going to use the TPE.

5. You can take a message and convert it into text for insertion into database columns:                                                                                                    

tempXMLData=IndividualMsg.BodyPart;
StringWriter=new System.IO.StringWriter();
XmlTextWriter=new System.Xml.XmlTextWriter(StringWriter);
tempXMLData.WriteTo(XmlTextWriter);
rawXmlData=StringWriter.ToString();

6. Using XPath, you can update attributes/elements. Example:  

xpathString=System.String.Format(”/*[local-name()=’Request’ and namespace-uri()=’http://exampleDataStore’]/*[local-name()=’sync’ and namespace-uri()=’http://exampleDataStore’]/*[local-name()=’after’ and namespace-uri()=’http://exampleDataStore’]/*[local-name()=’DataStore’ and namespace-uri()=’http://exampleDataStore’][{0}]/@*[local-name()=’FirstName’ and namespace-uri()='’]”,CurrentRecord);

xpath(tempDBInsertMsg,xpathString)=FirstName;

Word of caution though: you need to make sure that the attribute/element exists, xpath will not create it, just populate it.

7. Using Microsoft’s built in System.XML functionality; you can append data inside of an already existing xml structure. Example:

internalBeforeXmlDocument=IndividualMsg.BodyPart;
tempBeforeXML=(System.Xml.XmlDocument) tempBeforeXML.CloneNode(true);
XmlNode = tempBeforeXML.CreateNode (System.Xml.XmlNodeType.Element,”ns1″,”Record”,”http://appendexample.record/“);
XmlNode.InnerXml=internalBeforeXmlDocument.FirstChild.InnerXml;
tempBeforeXML.FirstChild.AppendChild(XmlNode);
BeforeMsg=tempBeforeXML;

8. Using Multi-part messages, you can call Business Rules to update ‘Context’ data, since the BRC cannot access the Context data, accessing the Context Part of the data serves the same purpose.

Here is the sample.

March 23, 2006

HL Numbering

Filed under: BizTalk, HIPAA — eric @ 8:15 pm

Back in the day (BizTalk 2002) the incremental numbers in the HL Segments were something that an average developer did not need to worry about.

However, with newer versions comes enhancements, built in tools that make it easier and quicker to develop the same solution. HL Numbering however is actually harder. Microsoft has decided that it is not going to modify any of the data inside of the Transaction using the HIPAA adapter. I had to create a process that would do the numbering.

The trick was to get the numbers to increment regardless of where in the transaction the work was being done. I used some simple C# code to create a constant variable and increment the number.
incrementer.JPG

I created a self contained orchestration that would accept a Claim (institutional or professional) re number it and then send it back. I did this so I can do my mapping logic and then finally plug this in.

The example here has the professional and institutional schemas included, but you would most likely have it in a seperate project that would contain the actual schemas, but I thought that it would be easiest to have it so that you could at least see the map in action.

You will have to add the projects as references to your professional and institutional projects, and then use a call orchestration shape and send the correct claim, and you will be ready to go.

March 3, 2006

HIPAA Pipeline vs. HIPAA Adapter

Filed under: BizTalk, HIPAA — eric @ 10:21 am

Here is a list of the behaviors that I have found when using the custom pipeline component vs the adapter for receiving and sending data:

Pipeline

  • Allows multiple recieve ‘locations’ for a single party, where you define a receive location that has the configuration information and then multiple pick ups and drop offs, where they can be any adapter (file, ftp, http, MQ Series, etc.) can be used
  • Ability to use Send Port Groups (archiving is an example of this usage)
  • Does not check the interchange control number for duplication per party
  • Data that is recieved or sent, is not archived in the location defined in the documentshome location in the parame table
  • No information is logged to the audin and audout tables, so the HIPAA_EDI reports in HAT is not available
  • Promoted properties in the WPC schemas are not invoked

Adapter

  • Only a single port can be defined for receiving and sending
  • Copies of both edi and xml data is stored in the documentshome location
  • Interchange control number checking is done
  • Information is stored in the audin and audout tables, so the HIPAA_EDI reports are accessable
  • Using the DefaultXML pipelines; promoted properties can be used for correllation/filtering/orchestration usage

I have put together a really simple example of both usages, so differences can be seen.

Instructions:

  1. Deploy the Solution
  2. Using the Deployment wizard, import the Binding.xml file
  3. In the Management Console, in the HIPAA_EDI adapter, in the properties of the Send Handler, set the the Party to Us
    HIPAAConfig1.JPG
    HIPAAConfig2.JPG
  4. Restart the HIPAA service
  5. Enable the Receive Locations
  6. Start the Send Port
  7. Drop the file into the ..\input directory and see if the file is produced in the ..\output directory
  8. Notice the following information in HAT - HIPAA_EDI Reports

March 1, 2006

Macros in a Dynamic Send Port

Filed under: BizTalk — eric @ 11:39 pm

A recent post in the BizTalk forum, promted this entry.

The question was asked how you can put the MessageID into a dynamic send port. I suggested that you would put a rule SendPort(Microsoft.XLANGs.BaseTypes.Address)=@”file://c:\”+DocumentMsg(BTS.MessageID)+”.xml”;
The next post was telling that you can put the macro in the Expression, which is true, you can, but in the below demo, it shows why it would be preferable not to use the macros.
I created a simple orchestration that shows both ways, here is the orchestration:
MessageID2.JPG

Here is the expression rule:

Here is the results of running the file through the orchestration:

MessageID5.JPG

In HAT, which is where I think that the real value of which method you use lies, here is the message flow, notice the filename is right in the first page of the message flow for the first outbound message, and the macro %MessageID% is found on the second message:

MessageID3.JPG

The message that uses the macro, you have to click on the link to see the actual message ID of what was saved.

MessageID4.JPG 

Again, here is the output:
MessageID5.JPG
At a recent client site, I used the macro initially, but then moved to the BTS.MessageID to ease in troubleshooting. Saving a couple of clicks when attempting to find the file really adds up after a while.

Below is a link to the sample solution that allows you to look at it and try it on your own.

Here

BAM gotcha

Filed under: BAM, BizTalk — eric @ 3:44 pm

When defining objects in the Excel BAM workbook, it allows for spaces. However, you cannot reference those spaced names in orchestrations, you must use the Name, not the DisplayName.

Here is the rule that will load it successfully into the BAM tables:
SpacedCheckpointLogic.JPG