Ureader.com  
Microsoft software help and Community
   home   |   control panel login   |   archive   |  
 
XML
data.xmlanalysis
mappoint.webservice
msf
msxml-webrelease
netmyservices.sdk
passport.sdk
soap
soapsdk
uddi.general
uddi.programming
uddi.specification
xml
xmlsqlwebrelease
xsl
  
 
date: Fri, 15 Feb 2008 07:12:02 -0800,    group: microsoft.public.xml.soap        back       


Asynchronous webservice call results in InvalidOperationException.   
I am trying to call a webservice method asynchronously.
This works correctly on compact framework. But, when I try it on .net 
(Desktop) it results in an InvalidOperationException. The StackTrace 
indicates that there is an error in the XML.
This exception is raised on calling the EndXYZ() function of the webservice.
Although using Fiddler I find that the xml response is correct. Then why do 
I get this exception?
date: Fri, 15 Feb 2008 07:12:02 -0800   author:   Rashmi C

Re: Asynchronous webservice call results in InvalidOperationException.   
"Rashmi C"  wrote in message 
news:5918541E-6BF4-459D-B561-F64B0B83C869@microsoft.com...
>I am trying to call a webservice method asynchronously.
> This works correctly on compact framework. But, when I try it on .net
> (Desktop) it results in an InvalidOperationException. The StackTrace
> indicates that there is an error in the XML.
> This exception is raised on calling the EndXYZ() function of the 
> webservice.
> Although using Fiddler I find that the xml response is correct. Then why 
> do
> I get this exception?

You are probably getting the exception because of invalid XML. Please post 
the complete details of the exception.
-- 
--------------------------------------------------------------------------------
John Saunders | MVP - Windows Server System - Connected System Developer
date: Fri, 15 Feb 2008 21:27:27 -0500   author:   John Saunders [MVP] john.saunders at trizetto.com

Re: Asynchronous webservice call results in InvalidOperationExcept   
The XML is in the correct format. Moreover it is the same XML that I get on 
the Compact framework without any exception.
Here is the Stack Trace:
There is an error in XML document (5, 495). ---> System.Xml.XmlException: 
Unexpected end of file has occurred. The following elements are not closed: 
result, ns1:getUpdateResponse, soapenv:Body, soapenv:Envelope. Line 5, 
position 495.
   at System.Xml.XmlTextReaderImpl.Throw(Exception e)
   at System.Xml.XmlTextReaderImpl.Throw(String res, String arg)
   at System.Xml.XmlTextReaderImpl.ThrowUnclosedElements()
   at System.Xml.XmlTextReaderImpl.ParseElementContent()
   at System.Xml.XmlTextReaderImpl.Read()
   at System.Xml.XmlTextReader.Read()
   at System.Xml.XmlReader.ReadString()
   at System.Xml.XmlTextReader.ReadString()
   at System.Xml.XmlReader.ReadElementString()
   at 
Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReaderPartnerService.Read3_getUpdateResponse(Boolean isNullable, Boolean checkType)
   at 
Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReaderPartnerService.Read6_getUpdateResponse()
   at 
Microsoft.Xml.Serialization.GeneratedAssembly.ArrayOfObjectSerializer1.Deserialize(XmlSerializationReader reader)
   at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader 
xmlReader, String encodingStyle, XmlDeserializationEvents events)
   --- End of inner exception stack trace ---
   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.EndInvoke(IAsyncResult 
asyncResult)
   at 
EMSystem.Service.PartnerGateway.PartnerService.EndgetUpdate(IAsyncResult 
asyncResult)
   at EMSystem.Service.Remote.GetWebService.HandleResponse(IAsyncResult 
asyncResult)

"John Saunders [MVP]" wrote:

> "Rashmi C"  wrote in message 
> news:5918541E-6BF4-459D-B561-F64B0B83C869@microsoft.com...
> >I am trying to call a webservice method asynchronously.
> > This works correctly on compact framework. But, when I try it on .net
> > (Desktop) it results in an InvalidOperationException. The StackTrace
> > indicates that there is an error in the XML.
> > This exception is raised on calling the EndXYZ() function of the 
> > webservice.
> > Although using Fiddler I find that the xml response is correct. Then why 
> > do
> > I get this exception?
> 
> You are probably getting the exception because of invalid XML. Please post 
> the complete details of the exception.
> -- 
> --------------------------------------------------------------------------------
> John Saunders | MVP - Windows Server System - Connected System Developer
> 
> 
>
date: Sun, 17 Feb 2008 22:06:00 -0800   author:   Rashmi C

Re: Asynchronous webservice call results in InvalidOperationExcept   
"Rashmi C"  wrote in message 
news:32B16B1B-90D5-477A-87FA-E44E7F56BC2F@microsoft.com...
> The XML is in the correct format. Moreover it is the same XML that I get 
> on
> the Compact framework without any exception.

Consider how unlikely it is that you are correct that there is no problem 
with the XML, but that .NET is incorrect.

How did you determine that it's the same XML? How did .NET determine that 
it's bad XML? Consider the difference between the two and ask yourself: how 
can we both be right?

> Here is the Stack Trace:
> There is an error in XML document (5, 495). ---> System.Xml.XmlException:
> Unexpected end of file has occurred. The following elements are not 
> closed:
> result, ns1:getUpdateResponse, soapenv:Body, soapenv:Envelope. Line 5,
> position 495.
>   at System.Xml.XmlTextReaderImpl.Throw(Exception e)
>   at System.Xml.XmlTextReaderImpl.Throw(String res, String arg)
>   at System.Xml.XmlTextReaderImpl.ThrowUnclosedElements()
>   at System.Xml.XmlTextReaderImpl.ParseElementContent()
>   at System.Xml.XmlTextReaderImpl.Read()
>   at System.Xml.XmlTextReader.Read()
>   at System.Xml.XmlReader.ReadString()
>   at System.Xml.XmlTextReader.ReadString()
>   at System.Xml.XmlReader.ReadElementString()
>   at
> Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReaderPartnerService.Read3_getUpdateResponse(Boolean 
> isNullable, Boolean checkType)
>   at
> Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReaderPartnerService.Read6_getUpdateResponse()
>   at
> Microsoft.Xml.Serialization.GeneratedAssembly.ArrayOfObjectSerializer1.Deserialize(XmlSerializationReader 
> reader)
>   at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader
> xmlReader, String encodingStyle, XmlDeserializationEvents events)
>   --- End of inner exception stack trace ---
>   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.EndInvoke(IAsyncResult
> asyncResult)
>   at
> EMSystem.Service.PartnerGateway.PartnerService.EndgetUpdate(IAsyncResult
> asyncResult)
>   at EMSystem.Service.Remote.GetWebService.HandleResponse(IAsyncResult
> asyncResult)

Hint: "Unexpected end of file has occurred". While you are asynchronously 
handling your response, .NET is reading and deserializing the response 
bytes. At some point, the XmlReader that is processing the data gets an EOF 
from the underlying stream. It determines that you still have unclosed 
elements, and throws an exception.

So the questions become, why does it think it's receiving the EOF, and why 
do you think that it is not receiving an EOF?

-- 
--------------------------------------------------------------------------------
John Saunders | MVP - Windows Server System - Connected System Developer
date: Tue, 19 Feb 2008 10:35:33 -0500   author:   John Saunders [MVP] john.saunders at trizetto.com

Google
 
Web ureader.com


    COPYRIGHT 2007, YARDI TECHNOLOGY LIMITED, ALL RIGHT RESERVE  |   contact us