Sending XML to a Web Service

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I'm using a web service proxy with a method that accepts a byte[] as a parameter. The intent is to send an XML document via this byte[]. I'm trying to do it with the following code

MemoryStream byteStream = new MemoryStream()
XmlTextWriter xml = new XmlTextWriter(byteStream, System.Text.UTF8Encoding.UTF8)

.....write the doc....

xml.Flush()
xml.Close()
byte[] data = byteStream.getBuffer()
webServiceClass.webServiceMethod(data)

the call to webServiceMethod reports a deserialization exception, array index out of bounds

Any help?
 
Why not just send the XML as a string and allow the underlying archtitecture
to serialize for you?

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

**********************************************************************
Think Outside the Box!
**********************************************************************
Brent Goodwin said:
I'm using a web service proxy with a method that accepts a byte[] as a
parameter. The intent is to send an XML document via this byte[]. I'm
trying to do it with the following code:
MemoryStream byteStream = new MemoryStream();
XmlTextWriter xml = new XmlTextWriter(byteStream, System.Text.UTF8Encoding.UTF8);

....write the doc.....

xml.Flush();
xml.Close();
byte[] data = byteStream.getBuffer();
webServiceClass.webServiceMethod(data);

the call to webServiceMethod reports a deserialization exception, array index out of bounds.

Any help?
 
Back
Top