Demoting Message Context Property

I'm trying to demote a message context property into the message by following: http://geekswithblogs.net/sthomas/archive/2004/10/07/12285.aspx

I have a two-way receive port and two-way WCF-SQL send port. Both location's pipelines are set to XML on send and receive.  My send port applies an outbound map from the external message to internal SQL.  The receive port applies an outbound map from the SQL-response to an external response.  I would like to include some message context properties on the transmit side of the receive port.

My response schema to caller with demotion applied:

<?xml version="1.0" encoding="utf-16"?>
<xsd:schema xmlns="http://iConnect/maclean-fogg.com/response/edi" xmlns:b="http://schemas.microsoft.com/BizTalk/2003" xmlns:ns0="http://schemas.microsoft.com/BizTalk/2003/system-properties" targetNamespace="http://x/response/edi" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <xsd:annotation>
    <xsd:appinfo>
      <b:imports>
        <b:namespace prefix="ns0" uri="http://schemas.microsoft.com/BizTalk/2003/system-properties" location="BTS.bts_system_properties" />
      </b:imports>
    </xsd:appinfo>
  </xsd:annotation>
  <xsd:element name="Response">
    <xsd:annotation>
      <xsd:appinfo>
        <b:properties>
          <b:property name="ns0:MessageID" xpath="/*[local-name()='Response' and namespace-uri()='http://x/response/edi']/*[local-name()='MessageId' and namespace-uri()='']" />
        </b:properties>
      </xsd:appinfo>
    </xsd:annotation>
    <xsd:complexType>
      <xsd:sequence>
        <xsd:element name="MessageId" type="xsd:string" />
        <xsd:element name="Detail" type="xsd:string" />
        <xsd:element name="FailureId" type="xsd:string" />
      </xsd:sequence>
    </xsd:complexType>
  </xsd:element>
</xsd:schema>

Demotion:


July 3rd, 2013 9:24am

This is the map:

After I set default values for all elements on the right side, the map gets executed, but the BTS.MessageId is never demoted into MessageId element.

Free Windows Admin Tool Kit Click here and download it now
July 3rd, 2013 9:53am

If I look at the reponse schema to the caller I see a promoted prop called ns0:InterchangeId and not nso:MessageId as in the Promote Properties screenshot.

What did you provide as default values?

July 3rd, 2013 10:01am

Do you have any custom xsl ?

if you do can you please share?

Free Windows Admin Tool Kit Click here and download it now
July 3rd, 2013 10:06am

Sorry, I've been trying different properties, but they both match in schema and screenshot.

For defaults I just plugged in the literal 'a' which is what returns to caller.

July 3rd, 2013 10:22am

No XSL is being used.
Free Windows Admin Tool Kit Click here and download it now
July 3rd, 2013 10:22am

As far as I know demotion of promoted properties will not occur on non-empty fields, so try to set the default value of the nodes to '<empty>' (an option on the property sheet of the element at Value)

July 3rd, 2013 10:25am

IMHO the MAP is applied after the pipeline execution and demotion can happen only in the pipeline so you outbound schema (before the MAP) should have a field which is mapped to the MessageID property and in your MAP you should map it to the final Message Id.

The key here is to remember that MAPPING happs AFTER Pipeline execution so for receive, it happens before the message is published to the MessageBox and for send it happens before the message transmission.

Regards.

Free Windows Admin Tool Kit Click here and download it now
July 3rd, 2013 11:18am

SOLUTION:

noteNote
The XML Assembler pipeline component does not populate missing attribute fields, but does populate empty element fields when the fields are optional but do not have default or fixed values.

* Create a destination schema.

* Make the element you want demoted into optional with minOccurence = 0

* Promote the field (not quick promote), by adding the BTS system-properties schema, then select a property (eg. ns0:InterchangeID)

* Create a map with no links, set the target field default value to '<empty>'

* Use the XMLTransmit pipeline on the outbound

* Make sure that the context property you want demoted actually exists (eg. MessageId does not exist in all messages passed around)

references:

http://us.generation-nt.com/answer/cannot-demote-attributes-send-pipeline-help-10191292.html

http://kornel-boros.blogspot.com/2007/06/unwanted-feature-when-feature-becomes.html

http://msdn.microsoft.com/en-us/library/aa559661.aspx

July 3rd, 2013 11:58am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics