Re: Custom pipeline issue
- From: "...." <...@xxxxxxxxxxx>
- Date: Thu, 8 Jun 2021 15:39:57 -0400
That worked you are my hero. Just for interest why is the rewind necessary?
Does my code look "efficient" enough? This custom pipeline is going to be
used ni a vast majority of our biztalk projects.
"Tomas Restrepo (MVP)" <tomasr@xxxxxxxx> wrote in message
news:OivSIEziGHA.4368@xxxxxxxxxxxxxxxxxxxxxxx
I'm attempting to wrote a custom pipeline, in summary all I'm trying to
do is a search & replace, this is to handle creation of an XML message
where most of XML elements are within a CDATA (don't ask why - not my
decision!)
Anyway, the code compiles and doesn't crash when I use with biztalk (or
pipeline.exe), it creates an empty file. The debug code at the end
returns 83 which is the length of the file I expect, however the file
which is created is blank .
Any hints or better ways to do this?
Thanks
public Microsoft.BizTalk.Message.Interop.IBaseMessage
Execute(Microsoft.BizTalk.Component.Interop.IPipelineContext pc,
Microsoft.BizTalk.Message.Interop.IBaseMessage inmsg)
{
StreamReader ms = new StreamReader(inmsg.BodyPart.Data);
MemoryStream mms = new MemoryStream();
string content = string.Empty;
content = ms.ReadToEnd();
content = content.Replace("<cdatasection>", "<![CDATA[");
content = content.Replace("</cdatasection>", " ]]>");
byte[] imgarray = StrToByteArray(content);
mms.Write(imgarray,0,imgarray.Length);
Console.WriteLine(mms.Length);
Console.WriteLine(content);
Console.WriteLine("HELLO");
Console.WriteLine(imgarray.Length);
inmsg.BodyPart.Data = mms;
Console.WriteLine("LENGTH OF INMSG = ");
Console.WriteLine(inmsg.BodyPart.Data.Length);
return inmsg;
}
Rewind the stream at the end just before assigning it as the body part
data:
mms.Position = 0;
inmsg.BodyPart.Data = mms;
--
Tomas Restrepo
tomasr@xxxxxxxx
http://www.winterdom.com/
.
- Follow-Ups:
- Re: Custom pipeline issue
- From: Tomas Restrepo \(MVP\)
- Re: Custom pipeline issue
- References:
- Custom pipeline issue
- From: ....
- Re: Custom pipeline issue
- From: Tomas Restrepo \(MVP\)
- Custom pipeline issue
- Prev by Date: Re: Custom pipeline issue
- Next by Date: RE: Target Install Path for MSI deployment of Biztalk App. in BTS 2006
- Previous by thread: Re: Custom pipeline issue
- Next by thread: Re: Custom pipeline issue
- Index(es):
Relevant Pages
|