Hi Anbu,
Are you using WSE ?. The Microsoft.Web.Services3.SoapEnvelope class has a
method to deserialize the body element.
CS.response myObject =
(CS.response)response.GetBodyObject(typeof(CS.resp onse));
Regards,
Pablo Cibraro
http://weblogs.asp.net/cibrax
"Anbu" <> wrote in message
news: ups.com...
> Hi All,
>
> I need to Deserialize the SoapService's SoapEnvelope response object.
>
> Here is the Body of the SoapEnvelope received as respone,
> <q1:serviceResponse xmlns:q1="urn:CallSetup"><serviceReturn
> xsi:type="q1:response"
> xmlnssi="http://www.w3.org/2001/XMLSchema-instance">ok</serviceReturn></q1:serviceResponse>
>
>
> When i try to deserialize with the same class from the client, I'm
> receiving the following error,
> There is an error in XML document (1, 2).
> at System.Xml.Serialization.XmlSerializer.Deserialize (XmlReader
> xmlReader, String encodingStyle, XmlDeserializationEvents events)
> at System.Xml.Serialization.XmlSerializer.Deserialize (XmlReader
> xmlReader, String encodingStyle)
> at System.Xml.Serialization.XmlSerializer.Deserialize (Stream stream)
>
> The source code is given below,
> try
> {
> CS.response myObject;
> XmlSerializer mySerializer = new
> XmlSerializer(typeof(CS.response));
>
> byte[] b =
> System.Text.Encoding.Unicode.GetBytes(response.Bod y.InnerXml);
> System.IO.MemoryStream ms = new MemoryStream(b);
>
> myObject = (CS.response)mySerializer.Deserialize(ms);
>
> }
> catch (Exception ex)
> {
> Console.WriteLine(ex.Message);
> Console.WriteLine(ex.StackTrace);
>
> }
>
> This above function works fine, if the XML data is as serialized
> <?xml version="1.0" encoding="utf-16"?><response>ok</response>
>
> Is there any way to Deserialize the SoapEnvelope from the soapservice?
>