Search code examples
biztalkbiztalk-2010biztalk-orchestrations

BizTalk Orchestration with Envelope Schema


I have Flat File Schema in which I set the Allow Message Breakup at Infix Root to true. And also I set the Record Max Occurrence 1. To dispatch the message and send the multiple message to the send port.I used a Receive Pipeline(with flat file disassemble) and Send Pipeline (XML Transmit) in the receive and send ports. Till this it worked fine.

The Flat File Schema

The input .txt File at the receive Port

1000 ABC IT 1001 DEF Maintenece 1002 GHI Payroll

The Output was three .xml files like

  <?xml version="1.0" encoding="utf-8" ?> 
  <Record xmlns="http://FlatFilewithEnvelop.FlatFileSchema1">
  <Employee xmlns="">
  <ID>1000</ID> 
  <Name>ABC</Name> 
  <Dept>IT</Dept> 
  </Employee>
  </Record>


 <?xml version="1.0" encoding="utf-8" ?> 
 <Record xmlns="http://FlatFilewithEnvelop.FlatFileSchema1">
 <Employee xmlns="">
 <ID>1001</ID> 
 <Name>DEF</Name> 
 <Dept>Maintenece</Dept> 
 </Employee>
 </Record>

 <?xml version="1.0" encoding="utf-8" ?> 
 <Record xmlns="http://FlatFilewithEnvelop.FlatFileSchema1">
 <Employee xmlns="">
 <ID>1002</ID> 
 <Name>GHI</Name> 
 <Dept>Payroll</Dept> 
 </Employee>
 </Record>

Now I wanted to send only the message with specific ID.So I added a Orchestration in to the Project where I am using decision shape, using the expression. Else I didn't want to send any message to the send Port.

Msg(FlatFilewithEnvelop.PropertySchema.ID) == 1000

Orchestration

If I send the same message in the Receive Port, I am getting four messages in the Send port(shown as below). I dont what was the mistake can anybody tell me what is the mistake.

<?xml version="1.0" encoding="utf-8" ?> 
<Record xmlns="http://FlatFilewithEnvelop.FlatFileSchema1">
<Employee xmlns="">
<ID>1000</ID> 
<Name>ABC</Name> 
<Dept>IT</Dept> 
</Employee>
</Record>

<?xml version="1.0" encoding="utf-8" ?> 
<Record xmlns="http://FlatFilewithEnvelop.FlatFileSchema1">
<Employee xmlns="">
   <ID>1000</ID> 
   <Name>ABC</Name> 
   <Dept>IT</Dept> 
  </Employee>
 </Record>

<?xml version="1.0" encoding="utf-8" ?> 
<Record xmlns="http://FlatFilewithEnvelop.FlatFileSchema1">
<Employee xmlns="">
<ID>1001</ID> 
<Name>DEF</Name> 
<Dept>Maintenece</Dept> 
</Employee>
</Record>

<?xml version="1.0" encoding="utf-8" ?> 
<Record xmlns="http://FlatFilewithEnvelop.FlatFileSchema1">
<Employee xmlns="">
  <ID>1002</ID> 
  <Name>GHI</Name> 
  <Dept>Payroll</Dept> 
  </Employee>
  </Record>

Solution

  • What is probably happening is that you initially created a send port with a filter subscribing to the messages.

    Then you created an Orchestration that also subscribes to the messages and is bound to the send port.

    If you look in BizTalk Server Administration Console and do a New Query and Search For Equals Subscriptions you will see a filter for your Send Port like below

        Property    Operator    Value   Group by
        http://schemas.microsoft.com/BizTalk/2003/system-properties.SPTransportID   ==  {GUID}  Or
        http://schemas.microsoft.com/BizTalk/2003/system-properties.MessageType ==  MesageType  And
    

    Notice how the subscription has an OR, the first will be the GUID for the port and the second part will be the filter you added to the port. Any message published by an Orchestration that is bound to the port will set the SPTransportID to the GUID of the port.

    The Filter on the send port is still looking for the messages and the Orchestration is also publishing a message to the port, hence the four messages.

    The solution. Remove the Filter from the port.