Solved

Run a process while a connection to a web service is being attempted

Posted on 2006-11-01
5
169 Views
Last Modified: 2010-04-23
Hi All,

I would like to display to the user that a connection to a web service is being attempted and display it, otherwise it can appear that the app is hung.

Using an example (theory only)

Dim svc as myservice.service
dim s as string = svc.mymethod("blah")

While the app is waiting for the return from the webservice, I would like to display something....like an animated gif. How could I do this?

Thanks
0
Comment
Question by:nzfire
  • 2
  • 2
5 Comments
 
LVL 35

Expert Comment

by:YZlat
ID: 17852951
use two separate threads
0
 
LVL 35

Expert Comment

by:YZlat
ID: 17852957
one for web service and one for process
0
 
LVL 10

Expert Comment

by:Kinger247
ID: 17852970
You can run the service with a callback, so after you call the webservice tou can run your gif or any other code.
The callback procedure will run to inform you the service has completed.

I've been trying to find some code on the web as an example.
Heres one I did find: http://www.dotnetjohn.com/articles.aspx?articleid=91
0
 
LVL 8

Expert Comment

by:Shakti109
ID: 17853059

The question here lies in when, and what you are really doing.

Typically, you add a web-reference to the web-service you wish to use in your project.

You define an instance and then call it's methods.

The question of "connection" is really one of what connection you are talking about.

In your web-service, are you requiring an authentication to the web-service itself, and then another call (that possibly contains state-date about the connection) to the exposed functions that "do the work"?

If not, this connection to the web-service is nearly transparent and the real connection you are "waiting on" is from the web-service to whatever resource it is touching (like a database).

Really in either case, a couple possible solutions are :

Wrap your call to the web-service methods inside a separate thread and while that thread is executing display a waiting message.

Another possible method :

Create a form that has the animation on it, give it no border or control box and size it to the exact size of the .animation.

When you are about to execute a call to the web-service (say svc.getdata("select * from mytable")), you create an instance of this form FIRST and display it and then make your call to the web-service, when the call gets its "stuff" from the web-service you destroy the instance of the form you just created.

I.E :

private sub get_webData()

dim tmp_Waitform as new frm_waiting
dim svc as myservice.service

tmp_waitform.show

try
    MyReturnData = svc.getdata("select * from mytable")
catch ex as exception
    ' error handling here
finally
   tmp_waitform.dispose
end try
 
end sub





0
 
LVL 10

Accepted Solution

by:
Kinger247 earned 500 total points
ID: 17853295
Ok, heres a REALLY GOOD example of what you need to do:

http://www.freevbcode.com/ShowCode.Asp?ID=5685

I just tried it an its just what you need.

The example webservice performs a long process and returns a value.
In the application it calls the web service and runs other code whilst the web service is still running.
When the webservice has finished it calls back to your app !
0

Featured Post

Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article explains how to create and use a custom WaterMark textbox class.  The custom WaterMark textbox class allows you to set the WaterMark Background Color and WaterMark text at design time.   IMAGE OF WATERMARKS STEPS Create VB …
Creating an analog clock UserControl seems fairly straight forward.  It is, after all, essentially just a circle with several lines in it!  Two common approaches for rendering an analog clock typically involve either manually calculating points with…
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question