views:

54

answers:

2

When accessing a cgi web service ,it throws the error [there is an error in xml document(] this error happens only If the return paramater is an array of objects

how to resolve this?

------------execption details--------------- System.InvalidOperationException was unhandled Message="There is an error in XML document (1, 452)." Source="System.Xml" StackTrace: at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader, String encodingStyle, XmlDeserializationEvents events) at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader, String encodingStyle) at System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(SoapClientMessage message, WebResponse response, Stream responseStream, Boolean asyncCall) at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters) at MyWebService.CallMyMethod(String hostName, String YourAppMyApptoken, Int32 subscription_id) in D:\Samjog\Temp Project\ProxyTest\ProxyTest\MyWebService.cs:line 93 at ProxyTest.Form1.btnListFeeds_Click(Object sender, EventArgs e) in D:\Samjog\Temp Project\ProxyTest\ProxyTest\Form1.cs:line 209 at System.Windows.Forms.Control.OnClick(EventArgs e) at System.Windows.Forms.Button.OnClick(EventArgs e) at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent) at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks) at System.Windows.Forms.Control.WndProc(Message& m) at System.Windows.Forms.ButtonBase.WndProc(Message& m) at System.Windows.Forms.Button.WndProc(Message& m) at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m) at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m) at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam) at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg) at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData) at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context) at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context) at System.Windows.Forms.Application.Run(Form mainForm) at ProxyTest.Program.Main() in D:\Samjog\Temp Project\ProxyTest\ProxyTest\Program.cs:line 18 at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args) at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args) at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly() at System.Threading.ThreadHelper.ThreadStart_Context(Object state) at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) at System.Threading.ThreadHelper.ThreadStart() InnerException: System.InvalidCastException Message="Cannot assign object of type System.Int32 to an object of type MyAppWSDLSubscribedFeedInfo." Source="dz-gayew" StackTrace: at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReaderMyWebService.Read19_CallMyMethodResponse() at Microsoft.Xml.Serialization.GeneratedAssembly.ArrayOfObjectSerializer14.Deserialize(XmlSerializationReader reader) at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader, String encodingStyle, XmlDeserializationEvents events) InnerException:

+2  A: 

If the XML is really malformed, the only thing I can suggest is getting the response as XML and then parsing it manually. It may just be that the .Net serialization does not fully understand its format.

Dmitri Nesteruk
can you give little more info on how to do this?
Samjog
A: 

Got the solution from following Link dont know if there is any better solution http://www.eggheadcafe.com/software/aspnet/34950281/soap-serialization-proble.aspx

Samjog