none
The Messaging Engine encountered an error during the processing of one or more inbound messages. RRS feed

  • Question

  • Hi,

    I have created BizTalk2010 application that picks up a zipped 835 file from the file system and sends it through a custom receive pipeline which contains:

      1) custom decoder component that promotes the Message Type property to use: http://schemas.microsoft.com/BizTalk/EDI/X12/2006#X12_00401_835

      2) custom disassember component that leverages SharpZipLib to unzip the file, then creates a message and adds the unzipped file to the new message

      3) EDI disassembler component that takes the unzipped 835 content and disassembles the segments

     

    Once through the receive pipeline, the send port is to take the content and do a straight passthrough to a flat file.

     

    When I deploy the application and drop the zip file, I receive the error "The Messaging Engine encountered an error during the processing of one or more inbound messages.".  Now if I remove the custom decoder from the receive pipeline & re-deploy, the file is unzipped and the raw EDI835 content is written to a flat file instead of being disassembled by the EDI Disassembler.  This leads me to believe that setting the Message Type to "http://schemas.microsoft.com/BizTalk/EDI/X12/2006#X12_00401_835" in the decoder is leading to the custom unzip disassembler attempting to disassemble the zipped up file based on the EDI835 schema, which causes the error.

    The code below is placed the Execute() method of my custom disassembler component...

    IBaseMessagePart message = pInMsg.BodyPart;
    
                    if (message != null)
                    {
                        Stream originalStream = message.GetOriginalDataStream();
    
                        if (originalStream != null)
                        {
                            using (ZipInputStream zipInputStream = new ZipInputStream(originalStream))
                            {
                                //read first file in the zip input stream
                                ZipEntry entry = zipInputStream.GetNextEntry();
    
                                //loop thru until there are no more files
                                while (entry != null)
                                {
                                    MemoryStream ms = new MemoryStream();
                                    byte[] buffer = new byte[1024];
                                    int bytesRead = Convert.ToInt32(buffer.Length);
    
                                    while (bytesRead != 0)
                                    {
                                        bytesRead = zipInputStream.Read(buffer, 0, buffer.Length);
                                        ms.Write(buffer, 0, bytesRead);
                                    }
    
                                    //set position within stream
                                    ms.Seek(0, SeekOrigin.Begin);
    
                                    //create message then add part named Body before adding the stream
                                    IBaseMessage output = pContext.GetMessageFactory().CreateMessage();
                                    output.AddPart("body", pContext.GetMessageFactory().CreateMessagePart(), true);
                                    
                                    //assign memory stream to the body part
                                    output.BodyPart.Data = ms;
                                    output.BodyPart.Charset = "UTF-8";
                                    output.BodyPart.ContentType = "application/EDI-X12";
                                    output.Context = PipelineUtil.CloneMessageContext(pInMsg.Context);
    
    
                                    messageQueue.Enqueue(output);
    
                                    //get the next item in the zip file
                                    entry = zipInputStream.GetNextEntry();
                                }
                            }
                        }
                    }
    


    The image below is the receive pipeline I am using.  My question is, "is there a way to set the Message Type to http://schemas.microsoft.com/BizTalk/EDI/X12/2006#X12_00401_835 in the EDI Disassembler?".  I am bit of a BizTalk newbie and would appreciate any I can get with this issue.  Thanks.

     

     

    Tuesday, September 20, 2011 2:55 PM

Answers

  • Thanks for your reply.

    I had added the decoder in order to assign the 835 EDI schema to the message as the Message Type so that the EDI Disassembler could process the EDI content once unzipped. 

    I fixed the issue by:

    1) placing the logic to unzip the file in the custom decoder

    2) removing the custom unzip disassembler from the Disassemble stage

    By doing this, I did not have to promote the Message Type property in the custom decoder.  Once the content was unzipped and added to the message in the decoder before being passed to the EDI Disassembler, the Message Type was set to the proper schema & the content was disassembled properly.

    • Marked as answer by lance_uppercut Tuesday, September 20, 2011 7:41 PM
    Tuesday, September 20, 2011 7:41 PM

All replies

  • Can you try by just removing the decode stage property promotion component.
    Regards,
    Bali
    MCTS: BizTalk Server 2010,BizTalk Server 2006 and WCF
    Blog: http://dpsbali-biztalkweblog.blogspot.com
    -----------------------------------------------------
    Mark As Answer or Vote As Helpful if this helps.
    • Proposed as answer by DPS Bali Thursday, September 22, 2011 6:38 AM
    Tuesday, September 20, 2011 3:23 PM
  • Thanks for your reply.

    I had added the decoder in order to assign the 835 EDI schema to the message as the Message Type so that the EDI Disassembler could process the EDI content once unzipped. 

    I fixed the issue by:

    1) placing the logic to unzip the file in the custom decoder

    2) removing the custom unzip disassembler from the Disassemble stage

    By doing this, I did not have to promote the Message Type property in the custom decoder.  Once the content was unzipped and added to the message in the decoder before being passed to the EDI Disassembler, the Message Type was set to the proper schema & the content was disassembled properly.

    • Marked as answer by lance_uppercut Tuesday, September 20, 2011 7:41 PM
    Tuesday, September 20, 2011 7:41 PM