Odpovědět Biztalk, custom disassembler and validations.

  • Wednesday, September 05, 2012 11:47 AM
     
     

    Hi

    I have written custom EDI disassembler. I have configured receive port to use my pipeline, but when it receives a message, it gives me an error saying:

    There was a failure executing the receive pipeline: "EDITest.ReceivePipeline1, EDITest, Version=1.0.0.0, Culture=neutral, PublicKeyToken=4a3d9b6272cad397" Source: "Batch Marker component" Receive Port: "ReceivePort1" URI: "C:\Temp\*.edi" Reason: A message was encountered with root element name of EdiDocument. It could not be classified as an X12 or Edifact message. The root namespace was 

    I guess biztalk tries to identify the message, but I want to just receive the message, convert it to xml(which my disassembler does) and forward it to send port. Send port is configured as PassThruTransmit. Any idea how do I fix this error?

    Thanks


    • Edited by Dato0011 Wednesday, September 05, 2012 11:48 AM
    •  

All Replies

  • Wednesday, September 05, 2012 2:55 PM
     
     
    Are you extending the Microsoft EDI Disassembler?  What components do you have in your receive pipeline?

    David Downing... If this answers your question, please Mark as the Answer. If this post is helpful, please vote as helpful.

  • Wednesday, September 05, 2012 2:56 PM
     
      Has Code

    No, I'm writing it from scratch.

    Here's the whole code:

        [ComponentCategory(CategoryTypes.CATID_PipelineComponent)]
        [ComponentCategory(CategoryTypes.CATID_DisassemblingParser)]
        [System.Runtime.InteropServices.Guid("BAEC7347-C749-4273-9119-C9450E34B3C6")]
        public class PipeTest : IDisassemblerComponent, IBaseComponent, IComponentUI
        {
            private IBaseMessage message;
            public void Disassemble(IPipelineContext pContext, IBaseMessage pInMsg)
            {
                message = pContext.GetMessageFactory().CreateMessage();
                message.AddPart("Body", pContext.GetMessageFactory().CreateMessagePart(), true);
    
                for (int i = 0; i < pInMsg.Context.CountProperties; i++)
                {
                    string Name, Namespace;
                    object PropertyValue = pInMsg.Context.ReadAt(i, out Name, out Namespace);
    
                    // If the property has been promoted, respect the settings
                    if (pInMsg.Context.IsPromoted(Name, Namespace))
                        message.Context.Promote(Name, Namespace, PropertyValue);
                    else
                        message.Context.Write(Name, Namespace, PropertyValue);
                }
    
                var parser = new CUSCAR_D95B();
                var errors = new List<ApplicationException>();
                var doc = parser.Parse(pInMsg.BodyPart.GetOriginalDataStream(), errors);
                var serializer = new XmlSerializer(typeof(EdiDocument));
                message.BodyPart.Data = new MemoryStream();
                serializer.Serialize(message.BodyPart.Data, doc);
                message.BodyPart.Data.Position = 0;
                message.BodyPart.ContentType = "text/xml";
            }
    
            public IBaseMessage GetNext(IPipelineContext pContext)
            {
                var result = message;
                message = null;
                return result;
            }
    

  • Wednesday, September 05, 2012 3:44 PM
     
     

    Which BizTalk application did you install your pipeline into (was it the "BizTalk EDI Application")?  Are you including a party resolver in your pipeline? Did you inspect the message context properties of your suspended message?  Much of the BizTalk EDI component processing is driven by message context properties.  Can you post your message context properties from your suspended message?


    David Downing... If this answers your question, please Mark as the Answer. If this post is helpful, please vote as helpful.

  • Thursday, September 06, 2012 6:54 AM
     
     

    Hi David

    Thank you for your support. I installed it to Biztalk Application 1 that ships by default with biztalk. I'm not using party resolver in my pipeline, just my custom disassembler. I never specified anywhere that receive/send port had to process EDI message, that's why I don't understand why Biztalk gives me such error.

    Here are context properties.

    Name Value Type Namespace
    FileCreationTime 9/5/2012 11:31:27 AM Not Promoted http://schemas.microsoft.com/BizTalk/2003/file-properties
    ReceivedFileName C:\Temp\MSC.edi Not Promoted http://schemas.microsoft.com/BizTalk/2003/file-properties
    PartNames System.String[] Not Promoted http://schemas.microsoft.com/BizTalk/2003/messageagent-properties
    ActivityIdentity {E102168C-7727-4588-93DE-395A5D5708E7} Not Promoted http://schemas.microsoft.com/BizTalk/2003/messagetracking-properties
    AdapterReceiveCompleteTime 9/5/2012 11:31:27 AM Not Promoted http://schemas.microsoft.com/BizTalk/2003/messagetracking-properties
    PortName ReceivePort1 Not Promoted http://schemas.microsoft.com/BizTalk/2003/messagetracking-properties
    SuspendedReceiveSideMessage True Not Promoted http://schemas.microsoft.com/BizTalk/2003/system-properties
    InboundTransportLocation C:\Temp\*.edi Promoted http://schemas.microsoft.com/BizTalk/2003/system-properties
    InterchangeID {5DF71C75-C657-4E3C-92FD-E3E05C906E1B} Not Promoted http://schemas.microsoft.com/BizTalk/2003/system-properties
    ReceiveLocationName Receive Location1 Not Promoted http://schemas.microsoft.com/BizTalk/2003/system-properties
    ReceivePortID {1BDA3B24-5DA1-4E0C-A760-49DE4EB4762A} Promoted http://schemas.microsoft.com/BizTalk/2003/system-properties
    ReceivePortName ReceivePort1 Promoted http://schemas.microsoft.com/BizTalk/2003/system-properties
    AuthenticationRequiredOnReceivePort False Not Promoted http://schemas.microsoft.com/BizTalk/2003/system-properties
    InboundTransportType FILE Promoted http://schemas.microsoft.com/BizTalk/2003/system-properties
    LRPMsgBodyTracking 0 Not Promoted http://schemas.microsoft.com/BizTalk/2003/system-properties
    MessageExchangePattern 1 Not Promoted http://schemas.microsoft.com/BizTalk/2003/system-properties
    ReceivePipelineID {86A6F0A4-A01D-45BF-A754-9A16641DD98B} Not Promoted http://schemas.microsoft.com/BizTalk/2003/system-properties
    ReceivePortAuth 0 Not Promoted http://schemas.microsoft.com/BizTalk/2003/system-properties
    ReceivePipelineConfig <Root xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><Stages><Stage CategoryId="9d0e4105-4cce-4536-83fa-4a5040674ad6"><Components><Component Name="Microsoft.BizTalk.Edi.Pipelines.EdiDisassembler"><Properties><AllowTrailingDelimiters vt="11">-1</AllowTrailingDelimiters><DetectMID vt="11">0</DetectMID><EdiDataValidation vt="11">-1</EdiDataValidation><MaskSecurityInformation vt="11">0</MaskSecurityInformation><XmlSchemaValidation vt="11">-1</XmlSchemaValidation></Properties></Component></Components></Stage><Stage CategoryId="9d0e410e-4cce-4536-83fa-4a5040674ad6"><Components><Component Name="Microsoft.BizTalk.Edi.BatchMarker.PartyBatchMarker"><Properties /></Component></Components></Stage></Stages></Root> Not Promoted http://schemas.microsoft.com/BizTalk/2003/system-properties

  • Thursday, September 06, 2012 2:09 PM
     
     
    Try stopping the "BizTalk EDI Application" (Full Stop), and unenlist all send ports and orchestrations in this application.  Then try your test again and see if you get the failure.

    David Downing... If this answers your question, please Mark as the Answer. If this post is helpful, please vote as helpful.


  • Friday, September 07, 2012 8:00 AM
     
      Has Code

    Thanks David again :)

    I tried that but I've got same result. I guess I'm missing something very trivial, I just can't find what.

    A message was encountered with root element name of EdiDocument. It could not be classified as an X12 or Edifact message. The root namespace was 

    I don't understand why the hell biztalk treats my message as edi document.

  • Friday, September 07, 2012 1:30 PM
     
     

    Can you export the bindings from your application and post it... make sure you clean up any URIs or servernames before posting.

    Do you have any other BizTalk applications configured?  Have you inspected your subscriptions to see if some other subscriber is picking up the messages?  Do you have any Parties configured?


    David Downing... If this answers your question, please Mark as the Answer. If this post is helpful, please vote as helpful.

  • Friday, September 07, 2012 1:34 PM
     
     

    Here's the bindings http://dl.dropbox.com/u/3055964/bindings.xml.

    I have parties configured, but I removed every associations from send/receive ports. There are no other applications which picks those messages. 


    • Edited by Dato0011 Friday, September 07, 2012 1:34 PM
    •  
  • Friday, September 07, 2012 2:04 PM
     
     Answered Has Code

    It seems like you've selected the BizTalk EDI Disassembler and Batch Marker in your pipeline (see snapshot below).  Check the pipeline you selected in your receive location.

    Try recompiling your custom pipeline and then remove all the cached binding files from "%APPDATA%\Microsoft\BizTalk Server\Deployment\BindingFiles\" before redeploying (back them up somewhere just in case).

    <ReceivePipelineData>
    	<Root xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    		<Stages>
    			<Stage CategoryId="9d0e4105-4cce-4536-83fa-4a5040674ad6">
    				<Components>
    					<Component Name="Microsoft.BizTalk.Edi.Pipelines.EdiDisassembler">
    						<Properties>
    							<AllowTrailingDelimiters vt="11">-1</AllowTrailingDelimiters>
    							<DetectMID vt="11">0</DetectMID>
    							<EdiDataValidation vt="11">-1</EdiDataValidation>
    							<MaskSecurityInformation vt="11">0</MaskSecurityInformation>
    							<XmlSchemaValidation vt="11">-1</XmlSchemaValidation>
    						</Properties>
    					</Component>
    				</Components>
    			</Stage>
    			<Stage CategoryId="9d0e410e-4cce-4536-83fa-4a5040674ad6">
    				<Components>
    					<Component Name="Microsoft.BizTalk.Edi.BatchMarker.PartyBatchMarker">
    						<Properties />
    					</Component>
    				</Components>
    			</Stage>
    		</Stages>
    	</Root>
    </ReceivePipelineData>


    David Downing... If this answers your question, please Mark as the Answer. If this post is helpful, please vote as helpful.



    • Edited by David K. Downing Friday, September 07, 2012 2:38 PM
    • Marked As Answer by Dato0011 Tuesday, September 11, 2012 1:48 PM
    •  
  • Tuesday, September 11, 2012 11:00 AM
     
     

    Thanks, I'll try and let you let you know the result :)

    UPDATE

    Thank you very much David, it worked :)

    • Edited by Dato0011 Tuesday, September 11, 2012 1:49 PM
    •