Groups | Blog | Home
all groups > dotnet web services > january 2008 >

dotnet web services : wrap xml in soap envelope without string builder


blackpope
1/31/2008 8:32:01 AM
I need to wrap xml in a soap envelope and don't want to concat strings
possible?
<env:Envelope xmlns:env="http.../envelope/">
<env:Header/>
<env:Body>
<QueryRequest > this part i already got to work using xsd to class and
xmlserializer
I just can't seem to be able to find a way to wrap the generated xml with
the soap
envelope above
</QueryRequest>
</env:Body>
</env:Envelope>

blackpope
1/31/2008 10:25:03 AM
it's in a string

[quoted text, click to view]
blackpope
1/31/2008 10:28:03 AM
actually i have it down to a stream(console.out) from which i can essentially
extract the string

XmlSerializer myserial = new XmlSerializer(newRequest.GetType());
myserial.Serialize(Console.Out, newRequest);

[quoted text, click to view]
John Saunders [MVP]
1/31/2008 12:39:07 PM
[quoted text, click to view]

There are many ways to do this depending on where the XML is that you want
to wrap. They will all come down to using an XmlWriter.

Where is your XML now? In a string? An XmlDocument?
--
--------------------------------------------------------------------------------
John Saunders | MVP - Windows Server System - Connected System Developer

John Saunders [MVP]
2/1/2008 7:06:29 AM
[quoted text, click to view]

Serialize has an overload that accepts an XmlWriter. So, you need to create
an XmlWriter, write the beginning of the SOAP envelope, serialize to the
XmlWriter, then write the end of the SOAP Envelope.
--
--------------------------------------------------------------------------------
John Saunders | MVP - Windows Server System - Connected System Developer

AddThis Social Bookmark Button