Home Page › Forums › BizTalk 2004 – BizTalk 2010 › Error in Custom Unzipping pipeline component that inherits Flat file disassembler (FFDasm)
- This topic has 0 replies, 1 voice, and was last updated 9 years, 2 months ago by
community-content.
-
AuthorPosts
-
-
March 27, 2013 at 9:14 AM #26023
Hi,
I have a custom disassembler that unzips files. and files for which an xml schema is defined, I call the base.Disassemble and base.GetNext methods to convert them from flat file to xml.
It works fine in some situations, however for some test sample files where Base.GetNext method should be called only once (and then null should be returned from FFDasm) it is getting called multiple times until it throws an exception with this message
==============
Reason: Unexpected data found while looking for:
‘|’
The current definition being parsed is Record. The stream offset where the error occured is 1063. The line number where the error occured is 1. The column where the error occured is 1063.==============
I tried to check if the flat file in the sample zip files that does not match the schema configured, However when I validate the flat file instance against the schema, the validation is successful.
So what I did was I wanted to find out why so many times the Base.GetNext method is getting called and hence I read the message returned by the Base.GetNext method wrote it to the event log . When I do that the component works propertly !!!! Base.GetNext gets called only once and then the message returned is read and written to the event log. The moment I remove the piece of code( that reads the returned message and writes it to the event log) I get back the exception. And this happens for only certain sample zip files not all.
Here is the method that unzips the file
=====================================
private void UnZip(IPipelineContext pContext, IBaseMessage pInMsg)
{
string sBatchMark = Guid.NewGuid().ToString();
Ionic.Zip.ZipFile objZipFiles = Ionic.Zip.ZipFile.Read(pInMsg.BodyPart.Data);
IEnumerator<Ionic.Zip.ZipEntry> objZipEntries = objZipFiles.GetEnumerator();
//pContext.ResourceTracker.AddResource(objZipFiles);
//pContext.ResourceTracker.AddResource(objZipEntries);
objMessage = pInMsg;
IBaseMessage objResult, objDisassemResult;//
while (objZipEntries.MoveNext())
{
objResult = pContext.GetMessageFactory().CreateMessage();
IBaseMessagePart objPart = pContext.GetMessageFactory().CreateMessagePart();
objPart.Data = new VirtualStream();
objZipEntries.Current.Extract(objPart.Data);
objPart.Data.Position = 0;
objResult.AddPart(“body”, objPart, true);
objResult.Context = objMessage.Context;
//pContext.ResourceTracker.AddResource(objResult);if (objFileExtensions.Contains(Path.GetExtension(objZipEntries.Current.FileName).ToUpper()))
{
base.Disassemble(pContext, objResult);
while ((objDisassemResult = base.GetNext(pContext)) != null)
{
//StreamReader sr = new StreamReader(objDisassemResult.BodyPart.Data);
//EventLog.WriteEntry(“Zip”, sr.ReadToEnd());objMessageList.Enqueue(objDisassemResult);
AddContextProperties(objDisassemResult, FileNameContextProperty, FileNameContextNamespace, objZipEntries.Current.FileName);
AddContextProperties(objDisassemResult, BatchMarkContextProperty, BatchMarkContextNamespace, sBatchMark);
}
}
else
{
objMessageList.Enqueue(objResult);
AddContextProperties(objResult, FileNameContextProperty, FileNameContextNamespace, objZipEntries.Current.FileName);
AddContextProperties(objResult, BatchMarkContextProperty, BatchMarkContextNamespace, sBatchMark);
}
}
}=====================================
If I uncomment the BOLD Lines it works fine , else It doesn’t
Any ideas why this is happening ??
PLEASE HELP
Thanks in advance
Surya
-
-
AuthorPosts
- The forum ‘BizTalk 2004 – BizTalk 2010’ is closed to new topics and replies.