I receive a flatfile HL7 message with the next records: MSH, EVN, PID and PV1. This message goes thru the pipeline component BTAHL7 2.X Disassembler. After the disassembler the BizTalk message contains 3 message parts: MSHSegment, BodySegments and ZSegments (which is empty in my case).
To use this message in an Orchestration you have to define a message as a multi-part message with these three parts. If you don’t do any processing in your Orchestration then you can use System.Xml.XmlDocument as message part type (it is only a reference).
You have to define these parts in the right order, so MSHSegment, BodySegments (with “Message Body Part” set to True) and ZSegments. If you don’t define these in the right order, you will receive an xlang/s error in the EventLog:
xlang/s engine event log entry: Uncaught exception (see the ‘inner exception’ below) has suspended an instance of service ‘MyCompany.MyOrchestration(da177201-2c29-4fbd-56f9-ad118705a27b)’.
The service instance will remain suspended until administratively resumed or terminated.
If resumed the instance will continue from its last persisted state and may re-throw the same unexpected exception.
InstanceId: 233a2806-2f36-46f2-9204-f8bfb2fc5403
Shape name: Receive_1
ShapeId: 160d728f-0375-4445-b21c-6e56d665eccc
Exception thrown from: segment 1, progress 3
Inner exception: Multi-part message ‘InboundMsg’ has body part ‘BodySegments’, expected body part ‘MSHSegment’.
Exception type: WrongBodyPartException
Source: Microsoft.XLANGs.BizTalk.Engine
Target Site: Void ReadMessageState(Microsoft.XLANGs.Core.Envelope, Microsoft.XLANGs.BaseTypes.XLANGMessage)
The following is a stack trace that identifies the location where the exception occuredat Microsoft.BizTalk.XLANGs.BTXEngine.BTXXlangStore.ReadMessageState(Envelope env, XLANGMessage msg)
at Microsoft.BizTalk.XLANGs.BTXEngine.BTXPortBase.ReceiveMessage(Int32 iOperation, Envelope env, XLANGMessage msg, Correlation[] initCorrelations, Context cxt, Segment s)
at ‘MyCompany.MyOrchestration.segment1(StopConditions stopOn)
at Microsoft.XLANGs.Core.SegmentScheduler.RunASegment(Segment s, StopConditions stopCond, Exception& exp)For more information, see Help and Support Center at http://go.microsoft.com/fwlink/events.asp.
You can find some more information here.




