BizTalk Server General - Adapter problem message body addes "." in the begining

This is Interesting: Free IT Magazines  
Home > Archive > BizTalk Server General > August 2005 > Adapter problem message body addes "." in the begining





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author Adapter problem message body addes "." in the begining
okaminer

2005-08-25, 7:48 am

Hi
I'm building my first adapter and I have the following problem.
when I convert the message body to string i get it with "." in the
begining ("." + the rest of the XML which is the correct message)

My code in the AsyncTransmitterBatch class in the send function is as
follow:
the parameter strByteBuf has the xml data is the end with "." as its
first charecter

s = bodyPart.GetOriginalDataStream()
s.Seek(0, SeekOrigin.Begin);
while (numBytesToRead > 0)
{
// Read may return anything from 0 to numBytesToRead.
int n = s. Read(RequestBuf,numBytesRead,numBytesToR
ead);
if (n==0)
break; // The end of the stream is reached.
numBytesRead += n;
numBytesToRead -= n;
}
//Write the data to a string and dump it to the tracewindow
strByteBuf = UTF8Encoding.UTF8.GetString(RequestBuf,0,numBytesRead);

Tomas Restrepo \(MVP\)

2005-08-25, 7:48 am

okaminer,

> I'm building my first adapter and I have the following problem.
> when I convert the message body to string i get it with "." in the
> begining ("." + the rest of the XML which is the correct message)
>
> My code in the AsyncTransmitterBatch class in the send function is as
> follow:
> the parameter strByteBuf has the xml data is the end with "." as its
> first charecter
>
> s = bodyPart.GetOriginalDataStream()
> s.Seek(0, SeekOrigin.Begin);
> while (numBytesToRead > 0)
> {
> // Read may return anything from 0 to numBytesToRead.
> int n = s. Read(RequestBuf,numBytesRead,numBytesToR
ead);
> if (n==0)
> break; // The end of the stream is reached.
> numBytesRead += n;
> numBytesToRead -= n;
> }
> //Write the data to a string and dump it to the tracewindow
> strByteBuf = UTF8Encoding.UTF8.GetString(RequestBuf,0,numBytesRead);


Are you absolutely sure you're dealing with an UTF-8 encoded string? Also,
why go through all the trouble of reading it like this, when you could've
just used a StreamReader?


--
Tomas Restrepo
tomasr@mvps.org
http://www.winterdom.com/


okaminer

2005-08-29, 7:49 am

Thanks for answering

You're right about the StreamReader. The code you see is something that
I got from the Visual studio when I opened a new Adapter projectthe
Internet and the code that I get from the visiual studio when create
adapter project

You where also right about the encoding I receive ASCII encoding and
not UTF-8 encoding

I'll change everything and give it a try

thanks a lot

Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com