Ask a Question related to ASP.NET Web Services, Design and Development.
-
Russell Mason #1
Asynchronous web service calls
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
Russell Mason Guest
-
Asynchronous calls from Java?
Hi, I want to listen for events on the java side and have a flex method called when something happens. How would I do this? This should be... -
Web service calls asynchronous vs synchronous
The best solution is to design you architecture using the observer pattern(GOF) K,Browne Developer -
handling exceptions in asynchronous web service calls
I have a win forms application that calls a web service asynchronously. Occassionally, the web service call with raise an exception. Unfortunately,... -
Asynchronous web service calls, will you still have timeouts
If I am calling web services asynchronously, will I still have to be concerned with the request timing out? If IIS starts a process (calling a web... -
Blocking problem/bug with enableSession=true and asynchronous web service calls?
Hi, I've found what appears to be a bug with ASP.NET web service method invocation - making it impossible to invoke and get the result of a... -
Russell Mason #2
Asynchronous web service calls
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
Russell Mason Guest
-
Sami Vaaraniemi #3
Re: Asynchronous web service calls
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.c om...> 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
Sami Vaaraniemi Guest
-
Russell Mason #4
Re: Asynchronous web service calls
Thanks, that gets me the exception I was looking for.
I assumed that sort of exception would be thrown on the call rather
than the callback. I thought the End... call was only required if you
wanted to pick up the results.
Thanks
Russell Mason
"Sami Vaaraniemi" <samivanospam@pleasejippii.fi> wrote in message news:<cet3v3$54m$1@phys-news1.kolumbus.fi>...> 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.c om...> > 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 MasonRussell Mason Guest



Reply With Quote

