Re: Asynchronous web service calls
From: Sami Vaaraniemi (samivanospam_at_pleasejippii.fi)
Date: 08/05/04
- Next message: Elp: "Re: RPC vs. Http"
- Previous message: Russell Mason: "Asynchronous web service calls"
- In reply to: Russell Mason: "Asynchronous web service calls"
- Next in thread: Russell Mason: "Re: Asynchronous web service calls"
- Reply: Russell Mason: "Re: Asynchronous web service calls"
- Messages sorted by: [ date ] [ thread ]
Date: Thu, 5 Aug 2004 14:04:44 +0300
Some of the web method calls are probably failing - my guess is its the "The
request failed with HTTP status 403" exception (i.e., you're exceeding the
web request queue in the server).
To see the errors, modify your code like so:
private void btnRun_Click(object sender, System.EventArgs e)
{
localhost.SimpleService service = new localhost.SimpleService();
for (int index = 0; index < 50; index++)
{
System.Diagnostics.Debug.WriteLine("Begin Do Nothing");
service.BeginDoNothing(new AsyncCallback(this.AWSCallback),
service); // <= note the 'service' parameter
}
}
private void AWSCallback(IAsyncResult ar)
{
try
{
localhost.SimpleService service =
(localhost.SimpleService)ar.AsyncState;
service.EndDoNothing(ar);
System.Diagnostics.Debug.WriteLine("End Do Nothing");
}
catch (Exception ex)
{
System.Diagnostics.Debug.WriteLine(ex.ToString());
}
}
hth,
Sami
"Russell Mason" <google@russellmason.com> wrote in message
news:5efeca96.0408050154.57605e91@posting.google.com...
> Hi
>
> I am trying to do some tests using asynchronous web service calls and
> have hit a problem. I have reduced the problem to the minimum so
> hopefully someone will be able to spot what's going on.
>
> I have a web service with 1 method:
>
> [ WebMethod() ]
> public void DoNothing()
> {
> System.Diagnostics.Debug.WriteLine("-- Doing Nothing");
> }
>
>
> and a Windows form client that calls the web service:
>
> private void btnRun_Click(object sender, System.EventArgs e)
> {
> localhost.SimpleService service = new localhost.SimpleService();
> for (int index = 0; index < 50; index++)
> {
> System.Diagnostics.Debug.WriteLine("Begin Do Nothing");
> service.BeginDoNothing(new AsyncCallback(this.AWSCallback), null);
> }
> }
>
> private void AWSCallback(IAsyncResult ar)
> {
> System.Diagnostics.Debug.WriteLine("End Do Nothing");
> }
>
> When I run this I get 50 "Begin Do Nothing" outputs to the debug
> window and 50 "End Do Nothing" outputs, but I only get a few (maybe
> 10, maybe 15) "-- Doing Nothing" outputs.
>
> When I look at the soap messages using MSSoapT I can see the that 50
> requests are being made, but after 10 or 15 calls the normal message:
>
> <?xml version="1.0" encoding="utf-8"?>
> <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xmlns:xsd="http://www.w3.org/2001/XMLSchema">
> <soap:Body>
> <DoNothing xmlns="http://tempuri.org/" />
> </soap:Body>
> </soap:Envelope>
>
> becomes:
>
> </Message>
>
> which is obviously invalid and no more calls are processed. Sometimes,
> maybe after 30 calls, the message seems to be in the correct format
> again but the call is still not processed. Sometimes once a messages
> becomes invalid all subsequent messages are invalid. I can't see a
> clear pattern.
>
> This works fine if called synchronously or if I call it asynchronously
> but put Thread.Sleep(1000) between calls (defeats the purpose of
> asynchronous calls but illustrates a point)
>
>
> Does anyone know what is happening here?
>
> Thanks
> Russell Mason
- Next message: Elp: "Re: RPC vs. Http"
- Previous message: Russell Mason: "Asynchronous web service calls"
- In reply to: Russell Mason: "Asynchronous web service calls"
- Next in thread: Russell Mason: "Re: Asynchronous web service calls"
- Reply: Russell Mason: "Re: Asynchronous web service calls"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|