intermittent error calling .NET web service

I'm getting an intermittent error when calling a .NET web service from a .NET 
console application.  Both are using v.1.1.4322 of the framework.

Any ideas on what could be causing this? It can fail and then a few seconds 
later can work fine.

The exception is:

<log4net:event logger="WRDataSyncApp" 
timestamp="2005-01-11T03:00:49.7336956-05:00" level="ERROR" thread="5808" 
domain="WRDataSyncApp.exe" 
username="CLT01IAWEB010N0\EquityAdmin"><log4net:message>Exception: 
System.InvalidOperationException
Message: There is an error in XML document (1, 290).
Source: System.Xml
   at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader 
xmlReader, String encodingStyle)
   at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader)
   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 DataSynchronization.ConferenceScheduler.GetAllRegistrations(String 
UserName, String Password)
   at DataSynchronization.RegistrationSyncable.AddWRDataToDataSet(DataSet 
ds, ConferenceScheduler webSrvc)
   at DataSynchronization.WRDataSync.SynchronizeData()
   at WRDataSyncApp.Main(String[] args)

Nested Exception

Exception: System.ArgumentOutOfRangeException
Message: Non-negative number required.
Parameter name: byteCount
Source: mscorlib
   at System.Text.UTF8Encoding.GetChars(Byte[] bytes, Int32 byteIndex, Int32 
byteCount, Char[] chars, Int32 charIndex, UTF8Decoder decoder)
   at System.Text.UTF8Decoder.GetChars(Byte[] bytes, Int32 byteIndex, Int32 
byteCount, Char[] chars, Int32 charIndex)
   at System.IO.StreamReader.ReadBuffer(Char[] userBuffer, Int32 userOffset, 
Int32 desiredChars, Boolean& readToUserBuffer)
   at System.IO.StreamReader.Read(Char[] buffer, Int32 index, Int32 count)
   at System.Xml.XmlScanner.Read()
   at System.Xml.XmlScanner.ScanEscape()
   at System.Xml.XmlScanner.ScanContent()
   at System.Xml.XmlTextReader.ParseBeginTagExpandCharEntities()
   at System.Xml.XmlTextReader.Read()
   at System.Xml.XmlReader.ReadElementString()
   at 
Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReader1.Read15_GetAllRegistrationsResponse()

</log4net:message><log4net:locationInfo class="WRDataSyncApp" method="Main" 
file="" line="0" /></log4net:event>

0
ern9876 (5)
1/13/2005 5:31:06 PM
dotnet.xml 7266 articles. 0 followers. Follow

9 Replies
1089 Views

Similar Articles

[PageSpeed] 14

Hi,

First of all, I would like to confirm my understanding of your issue. From 
your description, I understand that when you're referencing a webservice 
from a console app, some exception was thrown. If there is any 
misunderstanding, please feel free to let me know.

Could you let me know on which call did the exception thrown. Knowing the 
client side code and webservice code will be helpful for me to help you 
debugging on this issue.

Also, besides posting here, you can also try the 
microsoft.public.dotnet.framework.aspnet.webservices newsgroup, there are 
more people who will answer this question there.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no 
rights."

0
v-kevy (347)
1/14/2005 2:31:59 AM
Your understanding of the issue is correct. The exception stack trace has the 
answers to your other questions:

<log4net:event logger="WRDataSyncApp" 
timestamp="2005-01-12T03:00:04.9038753-05:00" level="ERROR" thread="5876" 
domain="WRDataSyncApp.exe" 
username="CLT01IAWEB010N0\EquityAdmin"><log4net:message>Exception: 
System.Web.Services.Protocols.SoapException
Message: Exception or Violation Occurred.
Source: System.Web.Services
   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 DataSynchronization.ConferenceScheduler.GetAllAnalysts(String 
UserName, String Password)
   at DataSynchronization.AnalystSyncable.AddWRDataToDataSet(DataSet ds, 
ConferenceScheduler webSrvc)
   at DataSynchronization.WRDataSync.SynchronizeData()
   at WRDataSyncApp.Main(String[] args)
</log4net:message><log4net:locationInfo class="WRDataSyncApp" method="Main" 
file="" line="0" /></log4net:event>
<log4net:event logger="WRDataSyncApp" 
timestamp="2005-01-12T14:00:30.5426304-05:00" level="ERROR" thread="5464" 
domain="WRDataSyncApp.exe" 
username="CLT01IAWEB010N0\EquityAdmin"><log4net:message>Exception: 
System.InvalidOperationException
Message: There is an error in XML document (1, 290).
Source: System.Xml
   at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader 
xmlReader, String encodingStyle)
   at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader)
   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 DataSynchronization.ConferenceScheduler.GetAllRegistrations(String 
UserName, String Password)
   at DataSynchronization.RegistrationSyncable.AddWRDataToDataSet(DataSet 
ds, ConferenceScheduler webSrvc)
   at DataSynchronization.WRDataSync.SynchronizeData()
   at WRDataSyncApp.Main(String[] args)

Nested Exception

Exception: System.ArgumentOutOfRangeException
Message: Non-negative number required.
Parameter name: byteCount
Source: mscorlib
   at System.Text.UTF8Encoding.GetChars(Byte[] bytes, Int32 byteIndex, Int32 
byteCount, Char[] chars, Int32 charIndex, UTF8Decoder decoder)
   at System.Text.UTF8Decoder.GetChars(Byte[] bytes, Int32 byteIndex, Int32 
byteCount, Char[] chars, Int32 charIndex)
   at System.IO.StreamReader.ReadBuffer(Char[] userBuffer, Int32 userOffset, 
Int32 desiredChars, Boolean& readToUserBuffer)
   at System.IO.StreamReader.Read(Char[] buffer, Int32 index, Int32 count)
   at System.Xml.XmlScanner.Read()
   at System.Xml.XmlScanner.ScanEscape()
   at System.Xml.XmlScanner.ScanContent()
   at System.Xml.XmlTextReader.ParseBeginTagExpandCharEntities()
   at System.Xml.XmlTextReader.Read()
   at System.Xml.XmlReader.ReadElementString()
   at 
Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReader1.Read15_GetAllRegistrationsResponse()

</log4net:message><log4net:locationInfo class="WRDataSyncApp" method="Main" 
file="" line="0" /></log4net:event>


"Kevin Yu [MSFT]" wrote:

> Hi,
> 
> First of all, I would like to confirm my understanding of your issue. From 
> your description, I understand that when you're referencing a webservice 
> from a console app, some exception was thrown. If there is any 
> misunderstanding, please feel free to let me know.
> 
> Could you let me know on which call did the exception thrown. Knowing the 
> client side code and webservice code will be helpful for me to help you 
> debugging on this issue.
> 
> Also, besides posting here, you can also try the 
> microsoft.public.dotnet.framework.aspnet.webservices newsgroup, there are 
> more people who will answer this question there.
> 
> Kevin Yu
> =======
> "This posting is provided "AS IS" with no warranties, and confers no 
> rights."
> 
> 
0
ern9876 (5)
1/14/2005 12:27:03 PM
Hello,

From the error message, it seems the web method cannot accept the Argument 
byteCount. Since the problem occurred randomly, is the value of byteCount 
changed randomly? If we set same value for "byteCount", can the problem be 
reproduce?

Luke

0
lukezhan (72)
1/17/2005 8:08:52 AM
Thank you for the reply. "byteCount" is not a parameter of the web method I 
am calling. The web method has two parameters: a user id and a password, 
which are both, unfortunately, hard coded into the application, so there is 
no possibility that they are not being supplied.

"[MSFT]" wrote:

> Hello,
> 
> From the error message, it seems the web method cannot accept the Argument 
> byteCount. Since the problem occurred randomly, is the value of byteCount 
> changed randomly? If we set same value for "byteCount", can the problem be 
> reproduce?
> 
> Luke
> 
> 
0
ern9876 (5)
1/18/2005 3:15:06 PM
One other thing: it would be helpful to know whether the read of the xml 
failed on the server side or the client side. Can you determine that from the 
exception stack trace?

"Eddie J" wrote:

> Thank you for the reply. "byteCount" is not a parameter of the web method I 
> am calling. The web method has two parameters: a user id and a password, 
> which are both, unfortunately, hard coded into the application, so there is 
> no possibility that they are not being supplied.
> 
> "[MSFT]" wrote:
> 
> > Hello,
> > 
> > From the error message, it seems the web method cannot accept the Argument 
> > byteCount. Since the problem occurred randomly, is the value of byteCount 
> > changed randomly? If we set same value for "byteCount", can the problem be 
> > reproduce?
> > 
> > Luke
> > 
> > 
0
ern9876 (5)
1/18/2005 3:33:05 PM
Hi,

We have replied to you on another thread in webservice newsgroup. Thanks!

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no 
rights."

0
v-kevy (347)
1/19/2005 5:55:45 AM
From the Stack Trace,  the problem occurred on client side. And the 
response data from web service is in incorrect format. Is .NET framework 
1.1 installed on both of your server and client?

Luke

0
lukezhan (72)
1/19/2005 9:04:10 AM
I believe we have found a solution to the problem. The web service has 
security features that prevent only certain IPs to call the web service. The 
web service was also external to the the corporate network I work within. 
When the call left the network, the IP address changed and would not be in 
the range of acceptable IPs, but sometimes it would.

Thanks for your help on this issue. I appreciate your prompt responses.

"[MSFT]" wrote:

> From the Stack Trace,  the problem occurred on client side. And the 
> response data from web service is in incorrect format. Is .NET framework 
> 1.1 installed on both of your server and client?
> 
> Luke
> 
> 
0
ern9876 (5)
1/20/2005 1:43:02 PM
Thank you for the update. I am very gald to hear the problem has been 
resolved.

Luke

0
lukezhan (72)
1/21/2005 2:49:19 AM
Reply:

Similar Artilces: