It won't give him the SOAP request or the HTTP headers - but it's close.
--------------------
>Message-ID: <>
>From: Trevor Pinkney <>
>Subject: Re: How to get the "raw" XML document returned from a web service
>References: <>
>Content-Type: text/plain; charset=iso-8859-1; format=flowed
>X-Newsreader: JetBrains Omea Reader 439.21
>Newsgroups: microsoft.public.dotnet.framework.aspnet.webservic es
>Date: Mon, 21 Feb 2005 11:20:40 -0800
>NNTP-Posting-Host: z-f5-0-0-229-s1.gw1.tor1.sprint-canada.net
206.186.91.250
>Lines: 1
>Path:
TK2MSFTNGXA02.phx.gbl!TK2MSFTNGXA01.phx.gbl!TK2MSF TNGP08.phx.gbl!TK2MSFTNGP1
4.phx.gbl
>Xref: TK2MSFTNGXA02.phx.gbl
microsoft.public.dotnet.framework.aspnet.webservic es:28225
>X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.webservic es
>
>This should do what you want.
>
> /// <summary>
> /// Converts an object to its xml representation
> /// </summary>
> public static string ObjectToXml(object objectToConvert)
> {
> MemoryStream memStream = new MemoryStream();
> XmlSerializer serializer = new XmlSerializer(objectToConvert.GetType());
> serializer.Serialize(memStream, objectToConvert);
> StreamReader reader = new StreamReader(memStream);
> memStream.Position = 0;
> return reader.ReadToEnd();
> }
>
>-Trevor
>
>
>
>Hello MikeL,
>
>> Hi, Keenan. Thanks for the response.
>>
>> The problem is on the consumer of the web service. They want the XML
>> document.
>>
>> I don't want to write another WebMethod just for this. I'd like to
>> know how to serialize the returned data to an XML doc. The following
>> code will do it and save it to disk, but ultimately I want not to
>> write it to disk, but rather store it in a "string" variable:
>>
>> System.Xml.Serialization.XmlSerializer s
>> = new
>> System.Xml.Serialization.XmlSerializer(typeof(seRe sults),https://www.s
>> omedomain.com/RatingHub);
>>
>> Stream fs = new
>> FileStream("D:\\stream.txt", FileMode.Truncate );
>>
>> XmlWriter writer = new XmlTextWriter(fs,
>> new UTF8Encoding());
>>
>> s.Serialize(writer, results);
>>
>> Any thoughts?
>>
>> Thanks again,
>>
>> Mike
>>
>> "Keenan Newton" <> wrote in message
>> news: oups.com...
>>
>>> Mike you should be able to pass the XmlElement object without a
>>> problem.
>>>
>>> [WebMethod]
>>> public System.Xml.XmlElement MyMethod()
>>> {
>>> //some code to get XmlElement
>>> return myXmlElement; //System.Xml.XmlElement
>>> }
>
>
>