BizTalk Gurus

Schema property promotion and envelop schema

rated by 0 users
Not Answered This post has 0 verified answers | 3 Replies | 2 Followers

Top 50 Contributor
32 Posts
Guo Ming Li posted on Tue, May 19 2009 10:25 PM

I have this following schema with element ElementB promoted as a message property (by defining a property schema) for routing purpose:

<SchemaA>
  <ElementB>BLAH1</ElementB>
  <ElementC>BLAH2</ElementC>
</SchemaA>

And I also have an envelop schema call <Envelop>.

I notice that when the message of type SchemaA is received, the property is promoted correctly, and hence the message is routed correctly.

However when the envelop schema is used, for example the following message is received at the receive port:

<Envelop>
  <SchemaA>
    <ElementB>BLAH1</ElementB>
    <ElementC>BLAH2</ElementC>
  </SchemaA>
  <SchemaA>
    <ElementB>BLAH3</ElementB>
    <ElementC>BLAH4</ElementC>
  </SchemaA>
  <SchemaA>
    <ElementB>BLAH5</ElementB>
    <ElementC>BLAH6</ElementC>
  </SchemaA>
<Envelop>

the message is splitted correctly into 3 different instances, however, the element ElementB was not promoted at all, hence causing a routing failure.

After a couple hours of trial and error, and I found a solution, which seems to resolve the problem. The solution is to create a map that maps message type SchemaA to same message type SchemaA. Then the map is placed in the received port. Hence, when a message is received with the envelop schema, the message will first decompose into different instances, then each instance will go through the map.

Although this solution seems to work, it doesn't look like the best solution because for every instance of message SchemaA, a map is used. Although this might not be an issue for schema with relative simple structure (similar to SchemaA), there will be impact to biztalk server performance if the schema structure becomes more complex.

Hence, is there a better/simpler solution that can fix this issue? Is it just a simple configuration change somewhere in the biztalk admin console or property of the envelop schema?

Thank you for your help in advance.

All Replies

Top 10 Contributor
874 Posts

I tested this scenario successfully i.e. using your Envelop message above I debatched it into 3 SchemaA messages each with the appropriate ElementB field promoted into the header. Here is the schema I used:

 

<?

 

xml version="1.0" encoding="utf-16"?>
<
xs:schema xmlns:ns0="http://GuoMingLi.Properties" xmlns:b="http://schemas.microsoft.com/BizTalk/2003" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<
xs:annotation>
<
xs:appinfo>
<
b:imports>
<
b:namespace prefix="ns0" uri="http://GuoMingLi.Properties" location=".\properties.xsd" />
</
b:imports>
<
b:schemaInfo is_envelope="yes" />
</
xs:appinfo>
</
xs:annotation>
<
xs:element name="Envelop">
<
xs:annotation>
<
xs:appinfo>
<
b:recordInfo body_xpath="/*[local-name()='Envelop' and namespace-uri()='']" />
</
xs:appinfo>
</
xs:annotation>
<
xs:complexType>
<
xs:sequence>
<
xs:element maxOccurs="unbounded" ref="SchemaA"/>
</
xs:sequence >
</
xs:complexType >
</
xs:element >
<
xs:element name="SchemaA">
<
xs:annotation >
<
xs:appinfo >
<
b:properties >
<
b:property name="ns0:ElementB" xpath="/*[local-name()='SchemaA' and namespace-uri()='']/*[local-name()='ElementB' and namespace-uri()'']" />
</
b:properties >
</
xs:appinfo >
</
xs:annotation>
<
xs:complexType >
<
xs:sequence>
<
xs:element name="ElementB" type="xs:string"/>
<
xs:element name="ElementC" type="xs:string"/>
</
xs:sequence >
</
xs:complexType >
</
xs:element >
</
xs:schema >

 

 

 

 

Top 50 Contributor
32 Posts

Thanks greg for your reply. It seems like it's because of the method that I used to created the envelop schema. I will give your method a try soon.

Anyhow, here were the envelop schema I created that didn't promot the property properly:

  <?xml version="1.0" encoding="utf-16" ?>
- <xs:schema xmlns:b="http://schemas.microsoft.com/BizTalk/2003" xmlns="http://ArielBPM.Biztalk.WaitManagement.RegisterWaitSchemas" elementFormDefault="qualified" targetNamespace="http://ArielBPM.Biztalk.WaitManagement.RegisterWaitSchemas" xmlns:xs="http://www.w3.org/2001/XMLSchema">
- <xs:annotation>
- <xs:appinfo>
  <b:schemaInfo is_envelope="yes" root_reference="RegisteredWaitExpirys" xmlns:b="http://schemas.microsoft.com/BizTalk/2003" />
  </xs:appinfo>
  </xs:annotation>
- <xs:element name="RegisteredWaitExpirys">
- <xs:annotation>
- <xs:appinfo>
  <b:recordInfo body_xpath="/*[local-name()='RegisteredWaitExpirys' and namespace-uri()='http://ArielBPM.Biztalk.WaitManagement.RegisterWaitSchemas']" />
  </xs:appinfo>
  </xs:annotation>
- <xs:complexType>
- <xs:sequence>
  <xs:any />
  </xs:sequence>
  </xs:complexType>
  </xs:element>
  </xs:schema>

-----------------------------------------------------------------

  <?xml version="1.0" encoding="utf-16" ?>
- <xs:schema xmlns:ns0="http://ArielBPM.Biztalk.WaitManagement.Schemas.RegisterWaitPropertySchema" xmlns:b="http://schemas.microsoft.com/BizTalk/2003" xmlns="http://ArielBPM.Biztalk.WaitManagement.RegisterWaitSchemas" elementFormDefault="qualified" targetNamespace="http://ArielBPM.Biztalk.WaitManagement.RegisterWaitSchemas" xmlns:xs="http://www.w3.org/2001/XMLSchema">
- <xs:annotation>
- <xs:appinfo>
- <b:imports xmlns:b="http://schemas.microsoft.com/BizTalk/2003">
  <b:namespace prefix="ns0" uri="http://ArielBPM.Biztalk.WaitManagement.Schemas.RegisterWaitPropertySchema" location="ArielBPM.Biztalk.WaitManagement.Schemas.RegisterWaitPropertySchema" />
  </b:imports>
  </xs:appinfo>
  </xs:annotation>
- <xs:element name="RegisteredWaitExpiry" type="RegisteredWaitExpiry">
- <xs:annotation>
- <xs:appinfo>
- <b:properties>
  <b:property name="ns0:RegWaitID" xpath="/*[local-name()='RegisteredWaitExpiry' and namespace-uri()='http://ArielBPM.Biztalk.WaitManagement.RegisterWaitSchemas']/*[local-name()='RegWaitID' and namespace-uri()='http://ArielBPM.Biztalk.WaitManagement.RegisterWaitSchemas']" />
  <b:property distinguished="true" xpath="/*[local-name()='RegisteredWaitExpiry' and namespace-uri()='http://ArielBPM.Biztalk.WaitManagement.RegisterWaitSchemas']/*[local-name()='ClientCode' and namespace-uri()='http://ArielBPM.Biztalk.WaitManagement.RegisterWaitSchemas']" />
  <b:property distinguished="true" xpath="/*[local-name()='RegisteredWaitExpiry' and namespace-uri()='http://ArielBPM.Biztalk.WaitManagement.RegisterWaitSchemas']/*[local-name()='RegWaitID' and namespace-uri()='http://ArielBPM.Biztalk.WaitManagement.RegisterWaitSchemas']" />
  </b:properties>
  </xs:appinfo>
  </xs:annotation>
  </xs:element>
- <xs:complexType name="RegisteredWaitExpiry">
- <xs:sequence>
  <xs:element name="RegWaitID" type="xs:string" />
  <xs:element name="ClientCode" type="xs:string" />
  </xs:sequence>
  </xs:complexType>
  </xs:schema>

 -------------------------------------------------------------

  Here is a sample data:

<

 

 

ns0:RegisteredWaitExpirys xmlns:ns0="http://ArielBPM.Biztalk.WaitManagement.RegisterWaitSchemas" xmlns:i="http://www.w3.org/2001/XMLSchema-instance"><ns0:RegisteredWaitExpiry><ns0:RegWaitID>E1024902-6A70-4817-B281-7B3AB934E893</ns0:RegWaitID><ns0:ClientCode>BMS</ns0:ClientCode></ns0:RegisteredWaitExpiry></ns0:RegisteredWaitExpirys>

Top 10 Contributor
874 Posts

The problem is not in your schemas, but in some odd behaviour in the XmlDisassembler. This could be worth a bug report.

When you promote the RegWaitID value as both a promoted property and distinguished field in a single message both are promoted into the message context.
However, if your message is part of a debatched interchange only the distinguished field is put in the message context.

If you remove the distinguished field and only use the property promotion, then the property is promoted.

 

Page 1 of 1 (4 items) | RSS