473,606 Members | 2,101 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Webservice with asynchronous call

Hello group,

I'm trying to develop a proof of concept webservice which asynchronously
calls a function in a DLL. The function raises an event when it is finished,
and works when used as part of a windows form. When I try to hook up the
webservice to the event and call the WS, the CPU goes to 100% and I have to
restart the WWW service.

Does anyone have an idea as to how this can be done ... and if not,
directions to a tall bridge would come in handy.

Thanks in advance,

--
Tim Gallivan
I know I'm a great teacher because when I give a lesson, the person never
comes back.
Nov 21 '05 #1
4 3308
can you describe the flow a bit more?
The webservice - it is an ASMX?
and within the logic behind that ASMX, you do a BeginInvoke() on a delegate
that references your external DLL?
And then you return from the webmethod call. Is that right?

Or,
within the ASMX, you do BeginInvoke() on the delegate (eventually getting to
your external DLL) and then... what?

"Tim Gallivan" <no************ **********@edu. gov.on.ca> wrote in message
news:Oe******** ******@TK2MSFTN GP11.phx.gbl...
Hello group,

I'm trying to develop a proof of concept webservice which asynchronously
calls a function in a DLL. The function raises an event when it is finished, and works when used as part of a windows form. When I try to hook up the
webservice to the event and call the WS, the CPU goes to 100% and I have to restart the WWW service.

Does anyone have an idea as to how this can be done ... and if not,
directions to a tall bridge would come in handy.

Thanks in advance,

--
Tim Gallivan
I know I'm a great teacher because when I give a lesson, the person never
comes back.

Nov 21 '05 #2
Dino,

Thanks for responding.
Yes the webservice is an ASMX. The webservice needs to return a dataset
(which is returned by the call to the DLL in ClassA). I haven't been able to
figure out how to do it. I haven't been using BeginInvoke because I don't
know how to ... I have been using BeginDoAsyncTes t and EndDoAsyncTest in my
client.

Any help would be greatly appreciated, source code is below. Thanks in
advance, Tim

private DataSet dsRR;

[WebMethod]
public DataSet DoAsyncTest(Str ing sHost)
{
ClassA rr = new ClassA(sHost);
rr.ClassAComple te += new ClassA.ClassAEv entHandler(Text Handler);
rr.Start();

while(dsRR.Tabl es.Count == 0)
{
System.Threadin g.Thread.Sleep( 0);
}
return dsRR;
}

private void TextHandler(obj ect sender, RemoteRR.ClassA EventArgs e)
{
DataSet dsResults = new DataSet();

DataTable dtResults = dsResults.Table s.Add("Results" );
DataColumn dc = dtResults.Colum ns.Add("CallId" ,typeof(Int64)) ;
dtResults.Colum ns.Add("Error", typeof(Int16));
dtResults.Colum ns.Add("Results ",typeof(String ));
dtResults.Colum ns.Add("HTML",t ypeof(String));
dtResults.Colum ns.Add("Error", typeof(String)) ;

DataRow dr = dtResults.NewRo w();
dr["CallId"] = 1;
dr["Error"] = 0;
dr["Results"] = e.TimeToRespons e.ToString()+" "+e.TimeToFinis h.ToString();
dr["HTML"] = e.PageHTML.ToSt ring();
dr["Error"] = e.ErrorMessage. ToString();
dtResults.Rows. Add(dr);
dtResults.Accep tChanges();

dsRR = dsResults.Copy( );
}

--
Tim Gallivan
I know I'm a great teacher because when I give a lesson, the person never
comes back.

"Dino Chiesa [Microsoft]" <di****@online. microsoft.com> wrote in message
news:eS******** ******@TK2MSFTN GP12.phx.gbl...
can you describe the flow a bit more?
The webservice - it is an ASMX?
and within the logic behind that ASMX, you do a BeginInvoke() on a delegate that references your external DLL?
And then you return from the webmethod call. Is that right?

Or,
within the ASMX, you do BeginInvoke() on the delegate (eventually getting to your external DLL) and then... what?

"Tim Gallivan" <no************ **********@edu. gov.on.ca> wrote in message
news:Oe******** ******@TK2MSFTN GP11.phx.gbl...
Hello group,

I'm trying to develop a proof of concept webservice which asynchronously
calls a function in a DLL. The function raises an event when it is

finished,
and works when used as part of a windows form. When I try to hook up the
webservice to the event and call the WS, the CPU goes to 100% and I have

to
restart the WWW service.

Does anyone have an idea as to how this can be done ... and if not,
directions to a tall bridge would come in handy.

Thanks in advance,

--
Tim Gallivan
I know I'm a great teacher because when I give a lesson, the person never comes back.


Nov 21 '05 #3
it sure looks like you have a tight loop in the webservice, waiting for a
response from the DLL.
Rather than loop this way, I would look into WaitHandle and the WaitOne()
call.

For example, this page:
http://msdn.microsoft.com/library/en...itOneTopic.asp

....shows how to queue an item to the worker thread pool. You can do this
within the ASMX webmethod.

You may already have support for this in ClassA, I cannot tell.
If you can get a WaitHandle from the ClassA, then just call WaitOne() on
that. (in this case You don't need to use the CLR threadpool. )

-D
"Tim Gallivan" <no************ **********@edu. gov.on.ca> wrote in message
news:Ob******** ******@TK2MSFTN GP12.phx.gbl...
Dino,

Thanks for responding.
Yes the webservice is an ASMX. The webservice needs to return a dataset
(which is returned by the call to the DLL in ClassA). I haven't been able to figure out how to do it. I haven't been using BeginInvoke because I don't
know how to ... I have been using BeginDoAsyncTes t and EndDoAsyncTest in my client.

Any help would be greatly appreciated, source code is below. Thanks in
advance, Tim

private DataSet dsRR;

[WebMethod]
public DataSet DoAsyncTest(Str ing sHost)
{
ClassA rr = new ClassA(sHost);
rr.ClassAComple te += new ClassA.ClassAEv entHandler(Text Handler);
rr.Start();

while(dsRR.Tabl es.Count == 0)
{
System.Threadin g.Thread.Sleep( 0);
}
return dsRR;
}

private void TextHandler(obj ect sender, RemoteRR.ClassA EventArgs e)
{
DataSet dsResults = new DataSet();

DataTable dtResults = dsResults.Table s.Add("Results" );
DataColumn dc = dtResults.Colum ns.Add("CallId" ,typeof(Int64)) ;
dtResults.Colum ns.Add("Error", typeof(Int16));
dtResults.Colum ns.Add("Results ",typeof(String ));
dtResults.Colum ns.Add("HTML",t ypeof(String));
dtResults.Colum ns.Add("Error", typeof(String)) ;

DataRow dr = dtResults.NewRo w();
dr["CallId"] = 1;
dr["Error"] = 0;
dr["Results"] = e.TimeToRespons e.ToString()+" "+e.TimeToFinis h.ToString(); dr["HTML"] = e.PageHTML.ToSt ring();
dr["Error"] = e.ErrorMessage. ToString();
dtResults.Rows. Add(dr);
dtResults.Accep tChanges();

dsRR = dsResults.Copy( );
}

--
Tim Gallivan
I know I'm a great teacher because when I give a lesson, the person never
comes back.

"Dino Chiesa [Microsoft]" <di****@online. microsoft.com> wrote in message
news:eS******** ******@TK2MSFTN GP12.phx.gbl...
can you describe the flow a bit more?
The webservice - it is an ASMX?
and within the logic behind that ASMX, you do a BeginInvoke() on a delegate
that references your external DLL?
And then you return from the webmethod call. Is that right?

Or,
within the ASMX, you do BeginInvoke() on the delegate (eventually getting to
your external DLL) and then... what?

"Tim Gallivan" <no************ **********@edu. gov.on.ca> wrote in message
news:Oe******** ******@TK2MSFTN GP11.phx.gbl...
Hello group,

I'm trying to develop a proof of concept webservice which asynchronously calls a function in a DLL. The function raises an event when it is

finished,
and works when used as part of a windows form. When I try to hook up the webservice to the event and call the WS, the CPU goes to 100% and I
have to
restart the WWW service.

Does anyone have an idea as to how this can be done ... and if not,
directions to a tall bridge would come in handy.

Thanks in advance,

--
Tim Gallivan
I know I'm a great teacher because when I give a lesson, the person

never comes back.



Nov 21 '05 #4
I'm assuming a "tight loop" is a BAD thing. I'll try it your way, Dino.

Thanks for the quick reply,
--
Tim Gallivan
I know I'm a great teacher because when I give a lesson, the person never
comes back.

"Dino Chiesa [Microsoft]" <di****@online. microsoft.com> wrote in message
news:uc******** ******@TK2MSFTN GP12.phx.gbl...
it sure looks like you have a tight loop in the webservice, waiting for a
response from the DLL.
Rather than loop this way, I would look into WaitHandle and the WaitOne()
call.

For example, this page:
http://msdn.microsoft.com/library/en...itOneTopic.asp
...shows how to queue an item to the worker thread pool. You can do this
within the ASMX webmethod.

You may already have support for this in ClassA, I cannot tell.
If you can get a WaitHandle from the ClassA, then just call WaitOne() on
that. (in this case You don't need to use the CLR threadpool. )

-D
"Tim Gallivan" <no************ **********@edu. gov.on.ca> wrote in message
news:Ob******** ******@TK2MSFTN GP12.phx.gbl...
Dino,

Thanks for responding.
Yes the webservice is an ASMX. The webservice needs to return a dataset
(which is returned by the call to the DLL in ClassA). I haven't been able
to
figure out how to do it. I haven't been using BeginInvoke because I don't know how to ... I have been using BeginDoAsyncTes t and EndDoAsyncTest in

my
client.

Any help would be greatly appreciated, source code is below. Thanks in
advance, Tim

private DataSet dsRR;

[WebMethod]
public DataSet DoAsyncTest(Str ing sHost)
{
ClassA rr = new ClassA(sHost);
rr.ClassAComple te += new ClassA.ClassAEv entHandler(Text Handler);
rr.Start();

while(dsRR.Tabl es.Count == 0)
{
System.Threadin g.Thread.Sleep( 0);
}
return dsRR;
}

private void TextHandler(obj ect sender, RemoteRR.ClassA EventArgs e)
{
DataSet dsResults = new DataSet();

DataTable dtResults = dsResults.Table s.Add("Results" );
DataColumn dc = dtResults.Colum ns.Add("CallId" ,typeof(Int64)) ;
dtResults.Colum ns.Add("Error", typeof(Int16));
dtResults.Colum ns.Add("Results ",typeof(String ));
dtResults.Colum ns.Add("HTML",t ypeof(String));
dtResults.Colum ns.Add("Error", typeof(String)) ;

DataRow dr = dtResults.NewRo w();
dr["CallId"] = 1;
dr["Error"] = 0;
dr["Results"] = e.TimeToRespons e.ToString()+"

"+e.TimeToFinis h.ToString();
dr["HTML"] = e.PageHTML.ToSt ring();
dr["Error"] = e.ErrorMessage. ToString();
dtResults.Rows. Add(dr);
dtResults.Accep tChanges();

dsRR = dsResults.Copy( );
}

--
Tim Gallivan
I know I'm a great teacher because when I give a lesson, the person never comes back.

"Dino Chiesa [Microsoft]" <di****@online. microsoft.com> wrote in message
news:eS******** ******@TK2MSFTN GP12.phx.gbl...
can you describe the flow a bit more?
The webservice - it is an ASMX?
and within the logic behind that ASMX, you do a BeginInvoke() on a

delegate
that references your external DLL?
And then you return from the webmethod call. Is that right?

Or,
within the ASMX, you do BeginInvoke() on the delegate (eventually

getting
to
your external DLL) and then... what?

"Tim Gallivan" <no************ **********@edu. gov.on.ca> wrote in message news:Oe******** ******@TK2MSFTN GP11.phx.gbl...
> Hello group,
>
> I'm trying to develop a proof of concept webservice which

asynchronously > calls a function in a DLL. The function raises an event when it is
finished,
> and works when used as part of a windows form. When I try to hook up the > webservice to the event and call the WS, the CPU goes to 100% and I have to
> restart the WWW service.
>
> Does anyone have an idea as to how this can be done ... and if not,
> directions to a tall bridge would come in handy.
>
> Thanks in advance,
>
> --
> Tim Gallivan
> I know I'm a great teacher because when I give a lesson, the person

never
> comes back.
>
>



Nov 21 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

17
14774
by: Patrick | last post by:
I am almost certain that I could use HTTP Post/Get to submit XML Web Service call (over SSL as well, if using Version 3 of MSXML2) from an ASP Application? However, would I only be able to call web-service in a an asynchronous mode (with a callback function)? If so, how?
3
2195
by: Grigs | last post by:
Hello, I have an ASP.Net webform that shows numerous attributes of parts we sell. There is one portion of the form that I have the user click a button to get the information for. I did this for two reasons: 1) not everyone wants to see it every time. 2) Depending on the complexity of the part, it can take a while. Everything works great. However, on complex parts (say that return 10,000 + lines) the browser says it is "Not...
4
2703
by: Bamse | last post by:
Hi all, The problem is as follows: I need to authorize a user: through a WS; if a setting is on, the webservice will look in the local "database", if the setting is off it will connect to the server ip that is set in the configuration and call the same WS to check the user in the remote "database". So far I don't know if I can call a webservice method from a webservice method...
0
1553
by: Jens Weibler | last post by:
Hi, I'm trying to call a webservice asynchronous and works. But if I enter a wrong proxy webservice.Proxy = new WebProxy("b"); I won't get a callback with an async call like webservice.addEntryAsync(entry, null); (of cource registered previously with webservice.addTrackerEntryCompleted += ).
0
1618
by: Raymondr | last post by:
Hi, First a brief description of out application: We have a webapplication which calls a couple of webservices during one request (postback). These calls to the webservices are made concurrent using asynchronous webservices calls. The number of webservices called concurrent is between 1 and 18. The webservice calls are made using SSL with a X509 clientcertificate. The application is underhigh load
0
1572
by: Paul Hadfield | last post by:
Hi, From reading various articles on scalability issues, I understand that there is only a finite number of ASP.NET worker threads and any long running task within ASP.NET should be fired off on a seperate thread using an async call. All the articles I can find are either on implementing an async webpage, or calling an async webservice. I can not however find any article on how to make calls within a webservice asynchronous. Consider...
2
1614
by: =?Utf-8?B?S2FseWFu?= | last post by:
Hi, I have to make multiple calls (about 400K) to a webservice which returns a string. And currently it takes about a week to make all the calls. Instead of waiting for the webservice result before i make the next call, I rather want to make the calls and let the results comeback at its own pace. I used Asynchronous calling and callback method, but it does not seems to work. I am sure, asynchronous way will improve my program execution...
0
1377
by: sirmoreno | last post by:
Hi, In my web site I have some long tasks that I want to call without delaying the page rendering - without making the thread that handels the page request wait for the long task to end. I found two solutions but I can't figure out which one is better? 1. Asynchronous OneWay WebService: - Declare a OneWay method for the long task inside an asmx file in my website and WebReference it.
1
2029
by: dearprasan | last post by:
Hi, I am making a call to a asynchronous call to a webservice using callback. Before I make the asynchronous call, I am allowed to make the following cast: IHTMLDocument2 doc = (IHTMLDocument2) this.WebBrowser1.Document.Domdocument; But after the asynchronous call is made, and its callback procedure is handled, i get "Specified cast not valid" exception while I try to do the same cast as above. I can also see that the object attributes...
0
8009
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
7939
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8299
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6753
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
5962
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5456
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
3919
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
1548
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1285
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.