BizTalk XMLReceive promote properties not for all debatched messages - biztalk

I have a problem with my BizTalk solution: not all debatched MessageState messages contain correlationId property
My solution has document schema (GetMessageStateSchema.xsd), envelope schema (GetMessageStateEnvelopeSchema.xsd) and two document property schemas (GetMessageStatePropertySchema.xsd in the same project, PropertySchema.xsd in referenced project).
Message types: MessageState - document type from GetMessageStateSchema.xsd, MessageStateEnvelope - envelope type from GetMessageStateEnvelopeSchema.xsd
MessageState has three promoted properties: MessageId - property from GetMessageStatePropertySchema.xsd, Status - property from GetMessageStatePropertySchema.xsd, correlationId - property from PropertySchema.xsd
MessageId and correlationId have the same path to extract value from MessageState body
GetMessageStateSchema.xsd:
<xs:schema xmlns="http://test-project1" xmlns:ns1="https://TestProject1.Biztalk.Schemas.PropertySchema" xmlns:b="http://schemas.microsoft.com/BizTalk/2003" xmlns:ns0="http://test-project1/properties" attributeFormDefault="unqualified" elementFormDefault="qualified" targetNamespace="http://test-project1" version="1.0" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:annotation>
<xs:appinfo>
<b:schemaInfo root_reference="MessageState" xmlns:b="http://schemas.microsoft.com/BizTalk/2003" />
<b:imports>
<b:namespace prefix="ns0" uri="http://test-project1/properties" location=".\GetMessageStatePropertySchema.xsd" />
<b:namespace prefix="ns1" uri="https://TestProject1.Biztalk.Schemas.PropertySchema" location="TestProject1.Biztalk.Schemas.PropertySchema" />
</b:imports>
</xs:appinfo>
</xs:annotation>
<xs:element name="MessageState">
<xs:annotation>
<xs:appinfo>
<b:properties>
<b:property distinguished="true" xpath="/*[local-name()='MessageState' and namespace-uri()='http://test-project1']/*[local-name()='MessageId' and namespace-uri()='http://test-project1']" />
<b:property distinguished="true" xpath="/*[local-name()='MessageState' and namespace-uri()='http://test-project1']/*[local-name()='State' and namespace-uri()='http://test-project1']" />
<b:property name="ns0:State" xpath="/*[local-name()='MessageState' and namespace-uri()='http://test-project1']/*[local-name()='State' and namespace-uri()='http://test-project1']" />
<b:property name="ns1:correlationId" xpath="/*[local-name()='MessageState' and namespace-uri()='http://test-project1']/*[local-name()='MessageId' and namespace-uri()='http://test-project1']" />
<b:property name="ns0:MessageId" xpath="/*[local-name()='MessageState' and namespace-uri()='http://test-project1']/*[local-name()='MessageId' and namespace-uri()='http://test-project1']" />
<b:property distinguished="true" xpath="/*[local-name()='MessageState' and namespace-uri()='http://test-project1']/*[local-name()='Description' and namespace-uri()='http://test-project1']" />
</b:properties>
</xs:appinfo>
</xs:annotation>
<xs:complexType>
<xs:sequence>
<xs:element name="MessageId" type="xs:string" />
<xs:element name="State" type="xs:string" />
<xs:element name="Description" nillable="true" type="xs:string" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
GetMessageStateEnvelopeSchema.xsd:
<xs:schema xmlns="hhttp://test-project1" xmlns:b="http://schemas.microsoft.com/BizTalk/2003" elementFormDefault="qualified" targetNamespace="hhttp://test-project1" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:include schemaLocation=".\GetMessageStateSchema.xsd" />
<xs:annotation>
<xs:appinfo>
<b:schemaInfo is_envelope="yes" xmlns:b="http://schemas.microsoft.com/BizTalk/2003" root_reference="MessageStateEnvelope" />
</xs:appinfo>
</xs:annotation>
<xs:element name="MessageStateEnvelope">
<xs:annotation>
<xs:appinfo>
<b:recordInfo body_xpath="/*[local-name()='MessageStateEnvelope' and namespace-uri()='hhttp://test-project1']" />
</xs:appinfo>
</xs:annotation>
<xs:complexType>
<xs:sequence>
<xs:element maxOccurs="unbounded" ref="MessageState" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
GetMessageStatePropertySchema.xsd:
<xs:schema xmlns="http://TestProject1.BizTalk.Schemas.GetMessageStatePropertySchema" xmlns:b="http://schemas.microsoft.com/BizTalk/2003" xmlns:ns0="http://test-project1/properties" elementFormDefault="qualified" targetNamespace="http://test-project1/properties" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:annotation>
<xs:appinfo>
<b:schemaInfo schema_type="property" xmlns:b="http://schemas.microsoft.com/BizTalk/2003" />
</xs:appinfo>
</xs:annotation>
<xs:element name="MessageId" type="xs:string">
<xs:annotation>
<xs:appinfo>
<b:fieldInfo propertyGuid="a2c00b01-ce8e-4052-aef4-ecf018d7566e" />
</xs:appinfo>
</xs:annotation>
</xs:element>
<xs:element name="State" type="xs:string">
<xs:annotation>
<xs:appinfo>
<b:fieldInfo propertyGuid="e9d31718-23a4-41dc-b4a4-635334de7a88" />
</xs:appinfo>
</xs:annotation>
</xs:element>
</xs:schema>
PropertySchema.xsd:
<xs:schema xmlns:mdm="http://test-project2/properties" xmlns:ser="http://schemas.microsoft.com/2003/10/Serialization/" xmlns:b="http://schemas.microsoft.com/BizTalk/2003" xmlns:ns0="https://TestProject2.Biztalk.Schemas.PropertySchema" xmlns="http://TestProject2.Biztalk.Schemas.PropertySchema" elementFormDefault="qualified" targetNamespace="https://TestProject2.Biztalk.Schemas.PropertySchema" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:import schemaLocation=".\Types.xsd" namespace="http://test-project2" />
<xs:import schemaLocation=".\SimpleTypes.xsd" namespace="http://schemas.microsoft.com/2003/10/Serialization/" />
<xs:annotation>
<xs:appinfo>
<b:schemaInfo schema_type="property" xmlns:b="http://schemas.microsoft.com/BizTalk/2003" />
<b:references>
<b:reference targetNamespace="http://schemas.microsoft.com/2003/10/Serialization/" />
<b:reference targetNamespace="http://test-project2" />
</b:references>
</xs:appinfo>
</xs:annotation>
<xs:element name="correlationId" type="xs:string">
<xs:annotation>
<xs:appinfo>
<b:fieldInfo propertyGuid="d659a31d-c943-4465-9409-e8c371aaff5f" propSchFieldBase="MessageDataPropertyBase" />
</xs:appinfo>
</xs:annotation>
</xs:element>
</xs:schema>
Input envelope:
<MessageStateEnvelope xmlns="http://test-project1">
<MessageState xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<MessageId>32983DE3-6984-4E43-835A-464EAD74BEC6</MessageId>
<State>success</State>
<Description xsi:nil="true"/>
</MessageState>
<MessageState xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<MessageId>EE08D44A-79C3-4740-AB64-3C1FBB9F65A5</MessageId>
<State>success</State>
<Description xsi:nil="true"/>
</MessageState>
<MessageState xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<MessageId>4D820BC6-D6CA-4CF1-8CE4-79A6A900F715</MessageId>
<State>success</State>
<Description xsi:nil="true"/>
</MessageState>
<MessageState xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<MessageId>2CBE4C76-1E1B-49BA-A502-A7E1C708BEF9</MessageId>
<State>success</State>
<Description xsi:nil="true"/>
</MessageState>
<MessageState xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<MessageId>B3993229-5369-4965-9C78-50F554BE2759</MessageId>
<State>success</State>
<Description xsi:nil="true"/>
</MessageState>
<MessageState xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<MessageId>EBD836B8-64B9-4591-8CBD-EE5F10CCF9DC</MessageId>
<State>success</State>
<Description xsi:nil="true"/>
</MessageState>
<MessageState xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<MessageId>8C2EAE52-6052-46EE-9222-CE2E9EDA156D</MessageId>
<State>success</State>
<Description xsi:nil="true"/>
</MessageState>
<MessageState xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<MessageId>C7D9DACB-FDE2-48C6-825C-324AB6BCDCE8</MessageId>
<State>success</State>
<Description xsi:nil="true"/>
</MessageState>
<MessageState xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<MessageId>732F1940-6227-4DEA-972C-6A9CACCC86A9</MessageId>
<State>success</State>
<Description xsi:nil="true"/>
</MessageState>
<MessageState xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<MessageId>3C4C1269-19AA-4AFD-9477-687159DF6B32</MessageId>
<State>success</State>
<Description xsi:nil="true"/>
</MessageState>
<MessageState xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<MessageId>AC0850E5-0796-4F60-AFD6-38A1DC31C053</MessageId>
<State>error</State>
<Description>some error description</Description>
</MessageState>
</MessageStateEnvelope>
PS:

Related

BizTalk Xml disassembler not promoting properties

I have defined a schema with several promoted properties.
I have a two way send port that calls a rest service.
The rest service returns a response matching the message schema. The receive pipeline for the two way send port has an xml disassembler component in it.
I also have a two way receive port.
The receive pipeline of the receive port has a component that publishes multiple messages into the queue so they are available using the GetNext() function. One of the messages matches the schema I published. The next component in the pipeline is an xml disassembler component.
I would have thought that in both ports, because my receive port has an xml disassembler, it would publish the promoted properties of the message so that I can subscribe to them in send ports, The values are not being promoted and I don't know why that is.
Here is my message schema:
<?xml version="1.0" encoding="utf-16"?>
<xs:schema xmlns="http://MyMessage" xmlns:b="http://schemas.microsoft.com/BizTalk/2003" xmlns:ns0="https://MyMessageProperties.PropertySchema" targetNamespace="http://MyMessage" 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="https://MyMessageProperties.PropertySchema" location=".\PropertySchema.xsd" />
</b:imports>
</xs:appinfo>
</xs:annotation>
<xs:element name="MessageProcessingResult">
<xs:annotation>
<xs:appinfo>
<b:properties>
<b:property name="ns0:Category" xpath="/*[local-name()='MessageProcessingResult' and namespace-uri()='http://MyMessage']/*[local-name()='Category' and namespace-uri()='']" />
<b:property name="ns0:Code" xpath="/*[local-name()='MessageProcessingResult' and namespace-uri()='http://MyMessage']/*[local-name()='Code' and namespace-uri()='']" />
<b:property name="ns0:ComponentOfOrigin" xpath="/*[local-name()='MessageProcessingResult' and namespace-uri()='http://MyMessage']/*[local-name()='ComponentOfOrigin' and namespace-uri()='']" />
<b:property name="ns0:OriginalMessageTypeValue" xpath="/*[local-name()='MessageProcessingResult' and namespace-uri()='http://MyMessage']/*[local-name()='OriginalMessageType' and namespace-uri()='']/*[local-name()='Value' and namespace-uri()='']" />
<b:property name="ns0:OriginalMessageID" xpath="/*[local-name()='MessageProcessingResult' and namespace-uri()='http://MyMessage']/*[local-name()='OriginalMessageID' and namespace-uri()='']" />
</b:properties>
</xs:appinfo>
</xs:annotation>
<xs:complexType>
<xs:all>
<xs:element name="Category">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="Success" />
<xs:enumeration value="Problem" />
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="Code" type="xs:string" />
<xs:element name="ComponentOfOrigin" type="xs:string" />
<xs:element name="OriginalMessageID" type="xs:string" />
<xs:element name="OriginalMessageType" type="Type" />
</xs:all>
</xs:complexType>
</xs:element>
<xs:complexType name="Type">
<xs:all>
<xs:element minOccurs="1" maxOccurs="1" name="Value" type="xs:string" />
<xs:element minOccurs="0" maxOccurs="1" name="Name" type="xs:string" />
</xs:all>
</xs:complexType>
</xs:schema>
Here is my property schema:
<?xml version="1.0" encoding="utf-16"?>
<xs:schema xmlns="http://MyMessageProperties.PropertySchema" xmlns:b="http://schemas.microsoft.com/BizTalk/2003" targetNamespace="https://MyMessageProperties.PropertySchema" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:annotation>
<xs:appinfo>
<b:schemaInfo schema_type="property" xmlns:b="http://schemas.microsoft.com/BizTalk/2003" />
</xs:appinfo>
</xs:annotation>
<xs:element default="Problem" name="Category" type="xs:string">
<xs:annotation>
<xs:appinfo>
<b:fieldInfo propertyGuid="676ad92f-16de-42df-8758-6b92dc4816a6" />
</xs:appinfo>
</xs:annotation>
</xs:element>
<xs:element default="Unkown" name="Code" type="xs:string">
<xs:annotation>
<xs:appinfo>
<b:fieldInfo propertyGuid="74bf0ac9-fe44-4ef1-a27c-64afe0e334bb" />
</xs:appinfo>
</xs:annotation>
</xs:element>
<xs:element default="Unknown" name="ComponentOfOrigin" type="xs:string">
<xs:annotation>
<xs:appinfo>
<b:fieldInfo propertyGuid="860e8876-8a0e-4fbd-aebe-84ee12bfb041" />
</xs:appinfo>
</xs:annotation>
</xs:element>
<xs:element default="00000000-0000-0000-0000-000000000000" name="OriginalMessageTypeValue" type="xs:string">
<xs:annotation>
<xs:appinfo>
<b:fieldInfo propertyGuid="4d329f1d-4944-46e0-9ec9-4b87eb8d7a71" />
</xs:appinfo>
</xs:annotation>
</xs:element>
<xs:element default="00000000-0000-0000-0000-000000000000" name="OriginalMessageID" type="xs:string">
<xs:annotation>
<xs:appinfo>
<b:fieldInfo propertyGuid="5bc4a75a-8fb3-4b54-becc-89e5415d216d" />
</xs:appinfo>
</xs:annotation>
</xs:element>
</xs:schema>
The issue is that only ONE dissembler will execute.
Notice the graphics in the Disassemble stage vs the Decode stage.
The Decode components will fire in sequence, but the Disassemble stage will probe which component matches the message, and the first one that matches will fire, and only that one.
Pipelines (Microsoft)
As an example of execution modes, the Disassemble stage of a receive pipeline is a First Match stage, thus each component in the stage is called to see if it recognizes the message and can process it. If the component responds in the affirmative, then no other components in that stage are queried to see if they can also handle the message. However, the Decode stage of a receive pipeline has an execution mode of All, meaning that each component in this stage is called to process the message in the order in which they were configured. The first decoder might be to decrypt the message, while the second might be to decompress the message from a zipped format.
So if you want to promote properties and also de-batch, you need to do in both your custom Disassembler.
e.g.
outMsg.Context.Promote(Name, Namespace, PropertyValue);

BizTalk WCF-WebHttp mapping form-data variable from multi-occurrence nodes

My client's API requires variable data to be delivered to them via HTTP POST. Some of this data is mapped to the URL and some of the data is in the message body form variables:
Url: http://myclientapi.com/poNumber/111222/complete
Message body variables: carrier=FEDEX&trackingNumber=4XXXXXX&shipDate=2018-12-17
WCF-WebHttp port seems to be the ticket. It is easy enough to define a flat file schema for the message body variables (carrier, trackingNumber and shipDate).
My problem is the URL variable mapping for poNumber in the send port configuration. I want to do something like this:
<BtsHttpUrlMapping>
<Operation Name = "POSHIPPED" Method="POST" Url="/poNumber/{poNumber}/complete"/>
</BtsHttpUrlMapping>
Given that only single occurrence nodes can be promoted via property schema I can't map the poNumber data to the same nodes that I map the message body variables, nor do I want the poNumber name/value included in the message body.
Have I reached the limitations of this particular adapter?
Assuming that the repeating node you are talking about is in the destination schema going to the WCF-WebHttp adatper, and that the poNumber is in a non-repeating node on a schema that you are mapping from.
What you need to do is to create a Property Schema where you define the poNumber as MessageContextPropertyBase
Property Schema
<?xml version="1.0" encoding="utf-16"?>
<xs:schema xmlns="http://Scratch.SO53891801propertyschema" xmlns:b="http://schemas.microsoft.com/BizTalk/2003" targetNamespace="http://Scratch.SO53891801propertyschema" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:annotation>
<xs:appinfo>
<b:schemaInfo schema_type="property" />
</xs:appinfo>
</xs:annotation>
<xs:element name="poNumber" type="xs:string">
<xs:annotation>
<xs:appinfo>
<b:fieldInfo propertyGuid="3acc0f2f-64b0-4057-bc59-b8c76ab220a1" propSchFieldBase="MessageContextPropertyBase" />
</xs:appinfo>
</xs:annotation>
</xs:element>
</xs:schema>
You add this property schema your input schema. From your input where your orderNumber is in a non-repeating node, you link the poNumber to the property.
Sample input schema
<?xml version="1.0" encoding="utf-16"?>
<xs:schema xmlns="http://Scratch.SO53891801_input" xmlns:b="http://schemas.microsoft.com/BizTalk/2003" xmlns:ns0="http://Scratch.SO53891801propertyschema" targetNamespace="http://Scratch.SO53891801_input" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:annotation>
<xs:appinfo>
<b:imports>
<b:namespace prefix="ns0" uri="http://Scratch.SO53891801propertyschema" location=".\SO53891801propertyschema.xsd" />
</b:imports>
</xs:appinfo>
</xs:annotation>
<xs:element name="Root">
<xs:annotation>
<xs:appinfo>
<b:properties>
<b:property name="ns0:poNumber" xpath="/*[local-name()='Root' and namespace-uri()='http://Scratch.SO53891801_input']/*[local-name()='poNumber' and namespace-uri()='']" />
</b:properties>
</xs:appinfo>
</xs:annotation>
<xs:complexType>
<xs:sequence>
<xs:element name="poNumber" type="xs:string" />
<xs:element name="carrier" type="xs:string" />
<xs:element name="trackingNumber" type="xs:string" />
<xs:element name="shipDate" type="xs:date" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
Sample input file
<ns0:Root xmlns:ns0="http://Scratch.SO53891801_input">
<poNumber>poNumber_0</poNumber>
<carrier>carrier_0</carrier>
<trackingNumber>trackingNumber_0</trackingNumber>
<shipDate>1999-05-31</shipDate>
</ns0:Root>
Sample output schema
<?xml version="1.0" encoding="utf-16"?>
<xs:schema xmlns="http://Scratch.SO53891801" xmlns:b="http://schemas.microsoft.com/BizTalk/2003" targetNamespace="http://Scratch.SO53891801" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="HttpRequestBody">
<xs:complexType>
<xs:sequence>
<xs:element maxOccurs="unbounded" name="FromValue">
<xs:complexType>
<xs:sequence>
<xs:element name="Id" type="xs:string" />
<xs:element name="Value" type="xs:string" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
Create a map between the two.
Map
<?xml version="1.0" encoding="utf-16"?>
<mapsource Name="BizTalk Map" Version="2" BizTalkServerMapperTool_Version="3.0" XRange="100" YRange="420" OmitXmlDeclaration="Yes" UseXSLTransform="Undefined" TreatElementsAsRecords="No" OptimizeValueMapping="Yes" GenerateDefaultFixedNodes="Yes" PreserveSequenceOrder="No" IgnoreNamespacesForLinks="Yes" method="xml" CopyPIs="No" xmlVersion="1.0">
<SrcTree RootNode_Name="Root">
<Reference Location=".\SO53891801-input.xsd" />
</SrcTree>
<TrgTree RootNode_Name="HttpRequestBody">
<Reference Location=".\SO53891801.xsd" />
</TrgTree>
<ScriptTypePrecedence>
<CSharp Enabled="Yes" />
<ExternalAssembly Enabled="Yes" />
<VbNet Enabled="Yes" />
<JScript Enabled="Yes" />
<XsltCallTemplate Enabled="Yes" />
<Xslt Enabled="Yes" />
</ScriptTypePrecedence>
<TreeValues>
<TestValues />
<ConstantValues />
</TreeValues>
<Pages>
<Page Name="Page 1">
<Links>
<Link LinkID="1" LinkFrom="/*[local-name()='<Schema>']/*[local-name()='Root']/*[local-name()='carrier']" LinkTo="1" />
<Link LinkID="2" LinkFrom="/*[local-name()='<Schema>']/*[local-name()='Root']/*[local-name()='trackingNumber']" LinkTo="1" />
<Link LinkID="3" LinkFrom="/*[local-name()='<Schema>']/*[local-name()='Root']/*[local-name()='shipDate']" LinkTo="1" />
<Link LinkID="4" LinkFrom="/*[local-name()='<Schema>']/*[local-name()='Root']/*[local-name()='carrier']" LinkTo="/*[local-name()='<Schema>']/*[local-name()='HttpRequestBody']/*[local-name()='FromValue']/*[local-name()='Value']" />
<Link LinkID="5" LinkFrom="/*[local-name()='<Schema>']/*[local-name()='Root']/*[local-name()='trackingNumber']" LinkTo="/*[local-name()='<Schema>']/*[local-name()='HttpRequestBody']/*[local-name()='FromValue']/*[local-name()='Value']" />
<Link LinkID="6" LinkFrom="/*[local-name()='<Schema>']/*[local-name()='Root']/*[local-name()='shipDate']" LinkTo="/*[local-name()='<Schema>']/*[local-name()='HttpRequestBody']/*[local-name()='FromValue']/*[local-name()='Value']" />
<Link LinkID="7" LinkFrom="/*[local-name()='<Schema>']/*[local-name()='Root']/*[local-name()='carrier']" LinkTo="/*[local-name()='<Schema>']/*[local-name()='HttpRequestBody']/*[local-name()='FromValue']/*[local-name()='Id']" Compiler-Copy-Directive="CopyName" />
<Link LinkID="8" LinkFrom="/*[local-name()='<Schema>']/*[local-name()='Root']/*[local-name()='trackingNumber']" LinkTo="/*[local-name()='<Schema>']/*[local-name()='HttpRequestBody']/*[local-name()='FromValue']/*[local-name()='Id']" Compiler-Copy-Directive="CopyName" />
<Link LinkID="9" LinkFrom="/*[local-name()='<Schema>']/*[local-name()='Root']/*[local-name()='shipDate']" LinkTo="/*[local-name()='<Schema>']/*[local-name()='HttpRequestBody']/*[local-name()='FromValue']/*[local-name()='Id']" Compiler-Copy-Directive="CopyName" />
<Link LinkID="10" LinkFrom="1" LinkTo="/*[local-name()='<Schema>']/*[local-name()='HttpRequestBody']/*[local-name()='FromValue']" />
</Links>
<Functoids>
<Functoid FunctoidID="1" Functoid-FID="424" X-Cell="53" Y-Cell="173">
<Input-Parameters>
<Parameter Type="link" Value="1" linkIndex="0" Guid="7932e28c-0c98-4f47-aea8-f9a3a709eef0" />
<Parameter Type="link" Value="2" linkIndex="1" Guid="44112afb-3729-4d14-ba00-9053c96964a4" />
<Parameter Type="link" Value="3" linkIndex="2" Guid="eaecaba3-61c0-4cea-ae1b-16316322cea6" />
</Input-Parameters>
</Functoid>
</Functoids>
</Page>
</Pages>
</mapsource>
Context property in message
From the input schema it will promote the property, and it will still exist after the map has executed.
Showing the Context Property still exists after the map on the send port

BizTalk schema- Make Field Element tag name same a headers

I have a delimited file like this.
Name;ID;Type
ABC;1;Blue
PQR;2;Black
I am trying to make a flat file schema for the above data. But I am not able to find a way to make the XML tags match the headers.
the XML file it is creating is
<Root>
<Root_Child1>Root_Child</Root_Child1>
<Root_Child2>Root_Child</Root_Child2>
<Root_Child3>Root_Child</Root_Child3>
</Root>
What I want is something like this
<Root>
<Name>Root_Child</Name>
<ID>Root_Child</ID>
<Type>Root_Child</Type>
</Root>
I have 55 headers and it is a tedious job to manually change the XSD file . Is there an easier way to achieve this?
I think that this is not possible with only the Flat File Schema. You need to implement a map and create those tags and assign the values.
For example, with this Flat File Schema:
<?xml version="1.0" encoding="utf-16"?>
<xs:schema xmlns:b="http://schemas.microsoft.com/BizTalk/2003" xmlns="http://BizTalkMassCopy.FlatFileSchema8" targetNamespace="http://BizTalkMassCopy.FlatFileSchema8" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:annotation>
<xs:appinfo>
<schemaEditorExtension:schemaInfo namespaceAlias="b" extensionClass="Microsoft.BizTalk.FlatFileExtension.FlatFileExtension" standardName="Flat File" xmlns:schemaEditorExtension="http://schemas.microsoft.com/BizTalk/2003/SchemaEditorExtensions" />
<b:schemaInfo standard="Flat File" codepage="65001" default_pad_char=" " pad_char_type="char" count_positions_by_byte="false" parser_optimization="speed" lookahead_depth="3" suppress_empty_nodes="false" generate_empty_nodes="true" allow_early_termination="false" early_terminate_optional_fields="false" allow_message_breakup_of_infix_root="false" compile_parse_tables="false" root_reference="Root" />
</xs:appinfo>
</xs:annotation>
<xs:element name="Root">
<xs:annotation>
<xs:appinfo>
<b:recordInfo structure="delimited" child_delimiter_type="hex" child_delimiter="0xD 0xA" child_order="infix" sequence_number="1" preserve_delimiter_for_empty_data="true" suppress_trailing_delimiters="false" />
</xs:appinfo>
</xs:annotation>
<xs:complexType>
<xs:sequence>
<xs:annotation>
<xs:appinfo>
<groupInfo sequence_number="0" xmlns="http://schemas.microsoft.com/BizTalk/2003" />
</xs:appinfo>
</xs:annotation>
<xs:element name="Headers">
<xs:annotation>
<xs:appinfo>
<b:recordInfo structure="delimited" child_delimiter_type="char" child_delimiter=";" child_order="infix" sequence_number="1" preserve_delimiter_for_empty_data="true" suppress_trailing_delimiters="false" />
</xs:appinfo>
</xs:annotation>
<xs:complexType>
<xs:sequence>
<xs:annotation>
<xs:appinfo>
<groupInfo sequence_number="0" xmlns="http://schemas.microsoft.com/BizTalk/2003" />
</xs:appinfo>
</xs:annotation>
<xs:element name="Headers_Child1" type="xs:string">
<xs:annotation>
<xs:appinfo>
<b:fieldInfo justification="left" sequence_number="1" />
</xs:appinfo>
</xs:annotation>
</xs:element>
<xs:element name="Headers_Child2" type="xs:string">
<xs:annotation>
<xs:appinfo>
<b:fieldInfo justification="left" sequence_number="2" />
</xs:appinfo>
</xs:annotation>
</xs:element>
<xs:element name="Headers_Child3" type="xs:string">
<xs:annotation>
<xs:appinfo>
<b:fieldInfo justification="left" sequence_number="3" />
</xs:appinfo>
</xs:annotation>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element maxOccurs="unbounded" name="Item">
<xs:annotation>
<xs:appinfo>
<b:recordInfo structure="delimited" child_delimiter_type="char" child_delimiter=";" child_order="infix" sequence_number="2" preserve_delimiter_for_empty_data="true" suppress_trailing_delimiters="false" />
</xs:appinfo>
</xs:annotation>
<xs:complexType>
<xs:sequence>
<xs:annotation>
<xs:appinfo>
<groupInfo sequence_number="0" xmlns="http://schemas.microsoft.com/BizTalk/2003" />
</xs:appinfo>
</xs:annotation>
<xs:element name="Item_Child1" type="xs:string">
<xs:annotation>
<xs:appinfo>
<b:fieldInfo justification="left" sequence_number="1" />
</xs:appinfo>
</xs:annotation>
</xs:element>
<xs:element name="Item_Child2" type="xs:string">
<xs:annotation>
<xs:appinfo>
<b:fieldInfo justification="left" sequence_number="2" />
</xs:appinfo>
</xs:annotation>
</xs:element>
<xs:element name="Item_Child3" type="xs:string">
<xs:annotation>
<xs:appinfo>
<b:fieldInfo justification="left" sequence_number="3" />
</xs:appinfo>
</xs:annotation>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
And then you implement a Map with this Custom XSLT:
<?xml version="1.0" encoding="UTF-16"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt" xmlns:var="http://schemas.microsoft.com/BizTalk/2003/var" exclude-result-prefixes="msxsl var s0" version="1.0" xmlns:s0="http://BizTalkMassCopy.FlatFileSchema8" xmlns:ns0="http://BizTalkMassCopy.Schema2">
<xsl:output omit-xml-declaration="yes" method="xml" version="1.0" />
<xsl:template match="/">
<xsl:apply-templates select="/s0:Root" />
</xsl:template>
<xsl:template match="/s0:Root">
<xsl:variable name="var:v1" select="Headers/Headers_Child1/text()" />
<xsl:variable name="var:v2" select="Headers/Headers_Child2/text()" />
<xsl:variable name="var:v3" select="Headers/Headers_Child3/text()" />
<ns0:Root>
<xsl:for-each select="Item">
<xsl:element name="Items">
<xsl:element name="{$var:v1}">
<xsl:value-of select="Item_Child1" />
</xsl:element>
<xsl:element name="{$var:v2}">
<xsl:value-of select="Item_Child2" />
</xsl:element>
<xsl:element name="{$var:v3}">
<xsl:value-of select="Item_Child3" />
</xsl:element>
</xsl:element>
</xsl:for-each>
</ns0:Root>
</xsl:template>
</xsl:stylesheet>

How do I access a distinguished field in a BizTalk multipart message

I have a multipart message with this schema (edited for brevity):
<?xml version="1.0" encoding="utf-16"?>
<xs:schema xmlns="http://MyCompany/Schemas/Canonical/Property/1.0" xmlns:b="http://schemas.microsoft.com/BizTalk/2003" targetNamespace="http://MyCompany/Schemas/Canonical/Property/1.0" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="Property">
<xs:annotation>
<xs:appinfo>
<b:properties>
<b:property distinguished="true" xpath="/*[local-name()='Property' and namespace-uri()='http://MyCompany/Schemas/Canonical/Property/1.0']/*[local-name()='UPRN' and namespace-uri()='']" />
</b:properties>
</xs:appinfo>
</xs:annotation>
<xs:complexType>
<xs:sequence>
<xs:element minOccurs="0" maxOccurs="1" name="Addresses">
<xs:complexType />
</xs:element>
<xs:element minOccurs="0" maxOccurs="1" name="UPRN" type="xs:string" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
Given that the message name in an Orchestration is MyMessage, how would I access the value of the distinguished field 'UPRN' in a BizTalk Expression Editor.
When I try dot notation all I get from IntilliSense is MyMessage.Property
It's supposed to be:
MessageName.PartName.RootNode.ElememtName[...].FieldName

Biztalk schema variable number of columns in delimited file permitted?

Hiyas. I have a customer sending orders to us in a flat file. There isn't really any complexity to the file but there are some inconsistencies from file to file.
The format of the file is like this:
1,2,3[CRLF]
1,2,3[CRLF]
No problems creating a schema around that structure, however from time to time they will add a new column.
1,2,3,4[CRLF]
1,2,3,4[CRLF]
Unfortunatly, they don't make their changes cascade backwards so we hare expected to support both the 3 and 4 column formats. Both formats can potentially come through the same pipeline, so i don't really have the option of creating seperate schemas/pipelines. They do always add the new fields to the end of the row, so that much at least is consistent.
The only thiing i can think of to do is to create an elaborate "figure out which schema applies and route accordingly pipeline component", but before I go down that road I wanted to see if maybe anyone had some thoughts on way to make it work with a single flat file schema (I tried to set the minOccurs property of the optional columns to 0, but that was no good).
Thanks in advance for any advice.
One way would be to define a "outer" schema and import schemas for the different versions you need to support. The "outer" schema will offer a choice block containing references to your imported version schemas.
If you need to add the next version you just have to import a new schema and add it to the choice.
The hard part of course is how you can determine how to process different versions. Maybe the simplest way would be to create a map for every dedicated type you need to handle. On the other hand you could extend a "latest-and-greatest" internal message type and decide based on message content.
"outer" schema
<!-- language: xml-schema -->
<?xml version="1.0" encoding="utf-16"?>
<xs:schema xmlns:ns0="http://ACME.Version_001" xmlns:b="http://schemas.microsoft.com/BizTalk/2003" xmlns="http://ACME.Outer" xmlns:ns1="http://ACME.Version_002" targetNamespace="http://ACME.Outer" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:import schemaLocation=".\version_002.xsd" namespace="http://ACME.Version_002" />
<xs:import schemaLocation=".\version_001.xsd" namespace="http://ACME.Version_001" />
<xs:annotation>
<xs:appinfo>
<b:schemaInfo standard="Flat File" root_reference="Root" />
<schemaEditorExtension:schemaInfo namespaceAlias="b" extensionClass="Microsoft.BizTalk.FlatFileExtension.FlatFileExtension" standardName="Flat File" xmlns:schemaEditorExtension="http://schemas.microsoft.com/BizTalk/2003/SchemaEditorExtensions" />
<b:references>
<b:reference targetNamespace="http://ACME.Version_001" />
<b:reference targetNamespace="http://ACME.Version_002" />
</b:references>
</xs:appinfo>
</xs:annotation>
<xs:element name="Root">
<xs:annotation>
<xs:appinfo>
<b:recordInfo structure="delimited" sequence_number="1" child_delimiter_type="hex" child_order="postfix" child_delimiter="0x0D 0x0A" />
</xs:appinfo>
</xs:annotation>
<xs:complexType>
<xs:sequence>
<xs:choice minOccurs="1">
<xs:element ref="ns0:Version_001">
<xs:annotation>
<xs:appinfo>
<b:recordInfo sequence_number="1" structure="delimited" />
</xs:appinfo>
</xs:annotation>
</xs:element>
<xs:element ref="ns1:Version_002">
<xs:annotation>
<xs:appinfo>
<b:recordInfo sequence_number="2" structure="delimited" />
</xs:appinfo>
</xs:annotation>
</xs:element>
</xs:choice>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
Imported schema "Version_001"
<!-- language: xml-schema -->
<?xml version="1.0" encoding="utf-16"?>
<xs:schema xmlns:b="http://schemas.microsoft.com/BizTalk/2003" xmlns="http://ACME.Version_001" targetNamespace="http://ACME.Version_001" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:annotation>
<xs:appinfo>
<b:schemaInfo standard="Flat File" root_reference="Version_001" />
<schemaEditorExtension:schemaInfo namespaceAlias="b" extensionClass="Microsoft.BizTalk.FlatFileExtension.FlatFileExtension" standardName="Flat File" xmlns:schemaEditorExtension="http://schemas.microsoft.com/BizTalk/2003/SchemaEditorExtensions" />
</xs:appinfo>
</xs:annotation>
<xs:element name="Version_001">
<xs:annotation>
<xs:appinfo>
<b:recordInfo structure="delimited" child_delimiter_type="char" child_order="infix" rootTypeName="Version_001" child_delimiter="," />
</xs:appinfo>
</xs:annotation>
<xs:complexType>
<xs:sequence>
<xs:element name="Col1" type="xs:string" />
<xs:element name="Col2" type="xs:string" />
<xs:element name="Col3" type="xs:string" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
Imported schema "Version_002"
<!-- language: xml-schema -->
<?xml version="1.0" encoding="utf-16"?>
<xs:schema xmlns:b="http://schemas.microsoft.com/BizTalk/2003" xmlns="http://ACME.Version_002" targetNamespace="http://ACME.Version_002" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:annotation>
<xs:appinfo>
<b:schemaInfo standard="Flat File" root_reference="Version_002" />
<schemaEditorExtension:schemaInfo namespaceAlias="b" extensionClass="Microsoft.BizTalk.FlatFileExtension.FlatFileExtension" standardName="Flat File" xmlns:schemaEditorExtension="http://schemas.microsoft.com/BizTalk/2003/SchemaEditorExtensions" />
</xs:appinfo>
</xs:annotation>
<xs:element name="Version_002">
<xs:annotation>
<xs:appinfo>
<b:recordInfo structure="delimited" child_delimiter_type="char" child_order="infix" rootTypeName="Version_001" child_delimiter="," />
</xs:appinfo>
</xs:annotation>
<xs:complexType>
<xs:sequence>
<xs:element name="Col1" type="xs:string" />
<xs:element name="Col2" type="xs:string" />
<xs:element name="Col3" type="xs:string" />
<xs:element name="Col4" type="xs:string" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
(some default attributes omitted for readability)

Resources