none
Calling EDIDisassembler in Custom Pipeline component in Disassembler Stage RRS feed

  • Question

  • Hello

    I am having a requirement to receive Multiple Zipped EDI files . I tried creating a Disassemble Stage Custom Component to Unzip files and create mutiple messages how ever after those messages are created I need execute EDI Disasseble component on each of them. Seeking expert guidance what could be the best way to do.

    Since Disassemble stage allows only 1 component to be executed , I added reference to Micrsoft.BizTalk.Edi.PipelineComponents and got the EDIDisassembler class in my unzipper component. Composed my class with a local Variable of EDIDisassembler  and called its Disassemble & GetNext Methods. However the GetNext Methods errors giving an error "Object Ref not set" .

    I also tried passing single edi documents without unzip code i.e. a simple pass through to EDI Disassembler methods however it gives same error in GetNext() , any idea what could be missing , I could be missing a particular property of edidisassembler , checked the public ones which are fine with thier default values. please suggest ,Thanks for you help in Advance

     

     

    Monday, May 10, 2010 9:51 AM

All replies

  • Reading How the EDI Disassembler Works suggests that multiple interchanges in a single message are initially split into separate interchanges before disassembling starts*, so this gives us two approaches:

    • Create a simple Decode stage component that reads the zip file, extracts each file and writes its contents into a single stream; that single stream is then written into the message body and passed onto the EDIDisassembler component in the next stage of the pipeline;
    • Create a custom EDIDisassembler component that does the extraction mentioned above in the (overridden) Disassemble method.

    In both cases, the EDIDisassembler will see the message body containing multiple interchanges which will be disassembled automatically by the component. Be aware that writing the contents of the zip file into a stream in memory could be bad for overall runtime performance.

    Hope this helps, Nick.

    *This would make sense because an EDI file (for example) could include several interchanges.


    Nick Heppleston - Independent UK BizTalk Consultant (http://www.modhul.com)

    Please mark as answered if this answers your question.

    Looking for a fast and efficient way to archive EDI/AS2 messages in BizTalk? Try Atomic-Scope's new BizTalk Message Archiving Pipeline Component. Download a free 14-day trial!

    Monday, May 10, 2010 11:37 AM
  • Hello Nick , Thanks for you responses.

    I did try the second Approach , before posting and all though the disassemble method of edidisassembler works without any error i.e after i decompress the stream I create a new message with same context and pass it to Edidissembler.Disassemble() ; which is okay . however I would also need to call the GetNext Method of edi disassembler and that fails. i simply pass the calls to EDIDissassembler.GetNext() . Here it errors out saying Object ref Not set . upon inspecting the Edidissembler object it tells me that there is a private method which has error. Any thoughts ? I am missing setting some properties of edidisassembler.

    Actually i have NOT inherited from EDIDisassembler but created a private object of it & used it to call Disassemble() & GetNext()

    Tuesday, May 11, 2010 2:39 AM
  • Vikram,

    You *will* need to implement the IDisassembler interface to get this to work *if* you want to use a custom disassembler - are you sure that your custom disassembler is even being called by the receive pipeline at runtime?

    Alternatively, implement a custom Decode component and do the unzipping work in there, passing a single stream from the component (in fact, if you went for this approach, you could do some clever things with the ForwardEventingStream to reduce the memory overhead of the component).

    You may also want to take a look Tomas Restrepo's Pipeline testing framework which is excellent for testing custom pipeline components (among other things) in C# test cases (i.e. outside of the BizTalk runtime!).

    Let us know how you get on.

    Nick.


    Nick Heppleston - Independent UK BizTalk Consultant (http://www.modhul.com)

    Please mark as answered if this answers your question.

    Looking for a fast and efficient way to archive messages in BizTalk? Try Atomic-Scope's new BizTalk Message Archiving Pipeline Component. Download a free 14-day trial!

    Tuesday, May 11, 2010 7:47 AM
  • Hello Nick

    I think my first post says that "I tried creating a Disassemble Stage Custom Component to Unzip files " I have implemented the IDisassembler Interface with *DisAssemble Method* maniupulating the the zipped stream into uncompresses stream , now this process gives out multiple files and those are edi files so to parse them I have a local EDIDisassembler Class Object which also has Disassemble method which I call from my Disassemble Implementation after unzip . Here the EDIDisassembler.Disassemble calls goes through but gives an error later in GetNext() Method . which is the other Method required to be implemented in case of IDisassembler.

    I also set the stream position back to 0 or Begining of stream before i call the EDIDisassembler method, hope this explains that I have already done what you suggested in previous post.

    Tuesday, May 11, 2010 8:34 AM
  • Vikram,

    I would not create a local instance of the EDIDisassembler within your custom implementation.  Instead I would simply override the Disassemble method and unzip all files in the archive into a single stream (be aware of the size of this stream and take appropriate action); use this stream as the basis for the IBaseMessage parameter on the (base) Disassemble method. Override the GetNext() method, but just call the base implementation, as follows:

    - CustomEDIDisassembler

    - Disassembler()

    - Unzip and create custom IBaseMessage

    - Pass custom IBaseMessage to base.Disassemble()

    - GetNext()

    - Call base.GetNext()

     

    (I can't get the code formatting correct, but I'm sure you get the idea!)

    Again, I would probably start by creating a *working* custom EDIDisassembler without the unzip functionality, that can accept a single message that contains multiple interchanges. Once this is working, add the zip functionality.

    Nick.


    Nick Heppleston - Independent UK BizTalk Consultant (http://www.modhul.com)

    Please mark as answered if this answers your question.

    Looking for a fast and efficient way to archive messages in BizTalk? Try Atomic-Scope's new BizTalk Message Archiving Pipeline Component. Download a free 14-day trial!

    Wednesday, May 12, 2010 9:22 AM
  • Hello

    I have followed your approach mentioned in your last post however when the file type being used is a ZIP file the call does not pass to Disassemble method of the Component .  This component is inherited from BizTalk EDI Dis Assembler but does not overides any thing expect DisAssemble() , as you correctly mentioned Passing Single stream is better , however before even that code is execute it breaks giving error Unsupported Stream and the disassemble is not called at all. I am checking for some other alternatives to get around this.

    The approach mentioned is nice & practicall but i am still unable to get through it . Thanks Nick for your intrests in my post & Help.

    Monday, May 17, 2010 9:46 AM
  • Hello Vikramj

    Did you achieved it how did u proceeded

     

    thanks for your help in advance

    rameshkumar singh

     

    Tuesday, April 5, 2011 9:23 PM