Martijn's blog - E-Commerce, EAI, BizTalk and .NET

2006/01/12

Of BizTalk Server Schema Editor Extensions...

Ever wanted to add your own annotations to your schemas for some purpose like the Flat File extension, property promotion, the HWS extension or the TPM extension does? You can edit the schema by hand, but that wouldn’t be any fun, right? ;-) As an exercise, I’ve created two extensions which can easily be used in Visual Studio and extend the default schema editor, like the flat file extension does.

One of the extensions allows an annotation to be added to the root schema element which can be read somewhere else in order to execute a specific BRE policy belonging to the message. This solution could be used to execute a policy from a pipeline in a content-based routing scenario.

The other extension solves an issue a guy with me on a recent course has in processing COBOL copybooks. He needs to determine whether a field should be treated (and validated) as a date field instead of the normal numeric value. The extension allows for adding a property on any field stating it’s a date field according to the COBOL copybook standards.

Figuring out how and what with schema extensibility can be a daunting task, as documentation is scarce. If you end up developing with these extensions, look into these properties, as there are not used, but very interesting (and hopefully, self-descriptive):

InstanceGenerator
InstanceValidator
SchemaValidator

Also, note the custom tab on the CopyBookExtension. It stems from a method called by the schema editor called GetCustomViews and the tab shows which fields will be interpreted as a date.

Sourcecode for the CopyBookExtension is here, sourcecode for the BRECallPolicyExtension can be found here.

Using the extension is easy:
  1. Compile the extension. A post-build action will copy the output to the schema editor extension folder of BizTalk
  2. Open up a schema in Visual Studio
  3. Select the extension
  4. In case of the CopyBook extension, select a field and note the “CopyBook” group in the PropertyGrid
  5. In case of the BRECallPolicy extension, select the node and note the “BRE” group having a dropdown list of all published policies (latest only) or the error if nothing is found on the local host BizTalkRuleEngineDb ;-)
Let me know what you think!

3 Comments:

  • Hi Martijn,

    Cool information. However, can you give hints on how to access these annotations during runtime within a pipeline component? Currently, I use the ExploreOM to get hand on the XML Schema source, but that has some security issues (I get the connection string via WMI).
    Thanks!

    Sincerely

    Joerg Fischer

    By Anonymous Anonymous, at 3:51 PM  

  • Martijn

    You are about the only person I have found on the Net that claims to have written a BizTalk Schema Extension Editor. I found your blog posting on this from way back, and am very interested in looking at the code you wrote as I have to write my own Schema Extension Editor.

    Unfortunately your code doownload links are no longer valid. Is there any way you can post the code somewhere else or send it to me direclty to WebAdmin@BTUG.biz?

    Thanks,
    Rod

    By Anonymous Anonymous, at 6:15 PM  

  • Martijn

    You are about the only person I have found on the Net that claims to have written a BizTalk Schema Extension Editor. I found your blog posting on this from way back, and am very interested in looking at the code you wrote as I have to write my own Schema Extension Editor.

    Unfortunately your code doownload links are no longer valid. Is there any way you can post the code somewhere else or send it to me direclty to WebAdmin@BTUG.biz?

    Thanks,
    Rod

    By Anonymous Anonymous, at 6:16 PM  

Post a Comment

<< Home