Mohsin Kalam’s Blog

Schema Discovery


To describe how Schema Discovery is done within Engine Receive and Engine Send pipelines.

Engine Receive: 

A schema is required to validate and transform the envelopes/headers and the individual documents within the interchange during parsing. All the envelope validation is done against the control schemas shipped within BaseArtifact.dll. Once the envelope validation is done, R2 engine uses the following concatenation process to discover an individual schema:


For example:

In the above example



  • NameSpace comes from the party to which the document resolves to, otherwise from Global Settings*


Applicable if GS07 is valued as X

  • The first 5 chars of GS08 give the relevant information
    • Char 1 to 3 provide version
    • Char 4 to 5 provide release

If GS07 is not equal to X or GS08’s first 5 characters don’t provide a match

  • ISA12 provides the version/release information


  • ST01 gives the DocType



  • NameSpace comes from the party to which the document resolves to, otherwise from Global Settings*


  • UNH2.2 gives the Version
  • UNH2.3 gives the Release


  • UNH2.1 gives the DocType

*For each party, there is a default NameSpace defined under Party as Interchange Sender/Interchange Processing Properties section. This default NameSpace is used in most of the cases, however R2 gives customers the ability to override this default NameSpace through the use of Custom Transaction Set definitions. In case of X12, customers can define their target NameSpace for a party based on GS2 and ST1 of the document. If these 2 fields in the document match the one specified in PAM, the namespace defined in the target namespace will be used rather than the default namespace.

This is useful in cases where a 850 schema out of the box is deployed and is used for the majority of the cases. However tomorrow if a new partner wants to modify the existing 850 schema and setup a trading partner relationship with your business, you can deploy the modified 850 schema under a modified namespace, match the GS2 and ST1 from the instance in your PAM settings and can continue processing both the scenarios!

Once the engine has all the information, it uses this info to match the schemas deployed in the schema repository and uses that schema to parse the document.

Engine Send:

For individual transaction sets, Engine Send uses the individual transaction set schemas to validate/serialize those documents. For BIBO processing mode, Engine Send uses the control schema to validate all the envelope fields, and uses the individual transaction set schemas to validate individual transaction sets.  

Like Receive, Engine Send uses the same concatenation process to discover an individual schema:


However all this information is already present in the XML document itself.

Individual Transaction Sets:

 <gen0:X12_00401_810 xmlns:gen0=>











In the above example, the first line contains all the information. The first part after X12 gives the version/release (in this case it is 00401), the second part gives the DocType (in this case it is 810), and the namespace is


The node TransactionSet DocType has all the information

<TransactionSet DocType= TransactionSetActivityId=”>

<ns0:X12_00401_810 xmlns:ns0=>

As you see, it has the same format as the individual transaction set, and the same logic is applied. 

Once the engine has this information, it uses this info to match the schemas deployed in the schema repository and uses that schema to serialize the document.

End Note:

I hope this information has been useful to you. As always, your comments/questions are more than welcome!


Mohsin Kalam



  1. Hi Mohsin,
    I am using BIBO method to receive inbound 850 in orchestration. Would it be possible to access ISA , GS and BEG information in orchestration? Since I am using BIBO, I couldnt seperate PO and FA on receive shape filter. How can i seprate them in orchestraion?
    I want to update table with PO’s interchange number, po number and FA interchange number.
    How can I do it?
    Thank you in advance.

    Comment by siva — May 8, 2008 @ 8:17 pm

  2. The ISA and GS values are promoted individually and as a string. You can use these value in the Orchestration by adding the reference Microsoft.BizTalk.Edi.BaseArtifacts which will be at [drive]:\Program Files\Microsoft BizTalk Server 2006\Microsoft.BizTalk.Edi.BaseArtifacts.dll

    To get individual values, you can do the following

    variable= msgIn(EDI.ISA06);

    var1= msgIn(EDI.ISA08);

    var2= msgIn(EDI.GS02);

    var3= msgIn(EDI.GS03);

    var4= msgIn(EDI.ST01);

    var5= msgIn(EDI.GS08);

    To get the whole string, you can do the following


    so for a message of this header

    ISA*00* *00* *ZZ*THEM *ZZ*US *991221*1226*U*00401*000000025*0*T*>

    You will get the GS_Segment = GS*PO*THEM*US*19991221*1226*1*X*004010

    Hope this helps
    Mohsin Kalam

    Comment by Mohsin Kalam — May 27, 2008 @ 3:32 pm

RSS feed for comments on this post. TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

Blog at

%d bloggers like this: