By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,663 Members | 1,638 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,663 IT Pros & Developers. It's quick & easy.

Deserialization Error in VS 2005

P: n/a
I have a vendor web service that I have created a web application to
interact with. The service works fine in VS 2003 but fails in VS 2005. I
have implemented a proxy between the web client and web service to capture
the soap calls and both the request and response are identical. The problem
occurs in VS 2005 when the .net runtime attempts to de-serialize the soap
response into the custom type defined in the wsdl. The exact error message

Unable to cast object of type 'System.Xml.XmlText' to type

Stack Trace:

[InvalidCastException: Unable to cast object of type 'System.Xml.XmlText' to
type 'System.Xml.XmlElement'.]
Microsoft.Xml.Serialization.GeneratedAssembly.XmlS erializationReaderPRISMAPI.Read2_ContactDTO(Boolea n
isNullable, Boolean checkType) +5470
Microsoft.Xml.Serialization.GeneratedAssembly.XmlS erializationReaderPRISMAPI.Read30_ContactNewRespon se()
Microsoft.Xml.Serialization.GeneratedAssembly.Arra yOfObjectSerializer25.Deserialize(XmlSerialization Reader
reader) +63
System.Xml.Serialization.XmlSerializer.Deserialize (XmlReader xmlReader,
String encodingStyle, XmlDeserializationEvents events) +336

[InvalidOperationException: There is an error in XML document (1, 685).]
System.Xml.Serialization.XmlSerializer.Deserialize (XmlReader xmlReader,
String encodingStyle, XmlDeserializationEvents events) +781
System.Xml.Serialization.XmlSerializer.Deserialize (XmlReader xmlReader,
String encodingStyle) +53
System.Web.Services.Protocols.SoapHttpClientProtoc ol.ReadResponse(SoapClientMessage
message, WebResponse response, Stream responseStream, Boolean asyncCall)
System.Web.Services.Protocols.SoapHttpClientProtoc ol.Invoke(String
methodName, Object[] parameters) +292
PrismAPI.PRISMAPI.ContactNew() in
c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temp orary ASP.NET
Files\webui\bcb854b3\dc118bff\ csndbj.0.cs:443
_Default.Page_Load(Object sender, EventArgs e) in
d:\work\<snip>\WebPortalVS\trunk\src\WebUI\Default .aspx.cs:20
System.Web.Util.CalliHelper.EventArgFunctionCaller (IntPtr fp, Object o,
Object t, EventArgs e) +31
System.Web.Util.CalliEventHandlerDelegateProxy.Cal lback(Object sender,
EventArgs e) +68
System.Web.UI.Control.OnLoad(EventArgs e) +88
System.Web.UI.Control.LoadRecursive() +74
includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3035

Version Information: Microsoft .NET Framework Version:2.0.50727.42; ASP.NET

My first thought was to look at the type definitions generated when I set
the web reference in VS 2005, but it appears from the stack trace that this
is not available in the IDE at design time as it is dynamically compiled.
How can I see the Xml serialization attributes that were applied when the
web reference was set?

Any help is most appreciated.

Nov 23 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.