To pass an empty or zero sized message coming from source via biztalk

hi team,

We have a requirement to pass empty or 0kb files coming from source system via BizTalk to the destination.

We are in process of building a custom pipeline component. Could you please provide any suggestions which will be helpful for me.

Thanks in advance,

Veena Handadi

September 3rd, 2015 1:32am

Are you using File Adapter?

Then you have to create custom file adapter like this BizTalk and zero byte file.

Free Windows Admin Tool Kit Click here and download it now
September 3rd, 2015 1:39am

FTP adapter we are using.

September 3rd, 2015 1:40am

Hi Veena,

Empty file cannot be processed by BizTalk even on using pass-thru pipeline also it will not process. The only way to deal with it is to extent the adapter that you are using.

Here are some good links for this :

http://ninocrudele.me/2012/07/05/biztalk-and-zero-byte-file/

https://www.edistaffing.com/blog/2011/04/22/processing-empty-files-in-biztalk/

Please indicate "Mark as Answer" or "Mark as Helpful" if this post has answered the question

Regards

Rahul Madaan

biztalkvillage.blogspot.com

Free Windows Admin Tool Kit Click here and download it now
September 3rd, 2015 1:45am

FTP adapter we are using.

Hello,

If you are working with Flat file, you can refer my suggestion in this  thread and build your solution around it.

FTP Adapter does try and process an empty file and it throws an error no disassembler stage recognises the document

If your client actually wants the empty file to be processed and mapped to an XML document (which basically just had the summary of zero rows) and sent out as normal.

The only way to achieve this you have to create a BizTalk Decode pipeline component that checked to see if the length of the message was empty, and if it was, put a configurable string into the message so that it wasn't empty anymore and could be parsed by the flat file disassembler.


September 3rd, 2015 1:48am

Hi Rachit,

Thank you for your suggestion.

We are preparing the custom pipeline component in the same way. But in the IBaseComponentMembers, we can only return the value of type IBaseMessage. There we are unable to use Write() to give Write(new byte[0],0,0) when any empty message is encountered.

Free Windows Admin Tool Kit Click here and download it now
September 3rd, 2015 2:05am

hi Rachit,

When we are trying to do custom pipeline component, it shows stream was not writable. This is the below code we built. can you help me in this?

IBaseMessagePart bodyPart = inmsg.BodyPart;
            Stream originalStream = inmsg.BodyPart.GetOriginalDataStream();      
            if (originalStream.Length == 0)
           {
               System.IO.StreamWriter sw = new StreamWriter(originalStream);
               sw.Write("EmptyFile");
               inmsg.BodyPart.Data = originalStream;
              sw.Close();
              return inmsg;

September 4th, 2015 1:09am

Hi Veena,

The stream that you are getting from the BodyPart is a ReadOnly stream. You can crate a new empty MemoryStream for example and assign it to the BodyPart Data property.

MemoryStream targetStream = new MemoryStream();
System.IO.StreamWriter sw = new StreamWriter(targetStream );
sw.Write("EmptyFile");
inmsg.BodyPart.Data = targetStream;
return inmsg;

Regards.

Free Windows Admin Tool Kit Click here and download it now
September 4th, 2015 2:32am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics