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

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
LVL 1
nzfireAsked:
Who is Participating?
 
Kinger247Commented:
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
 
YZlatCommented:
use two separate threads
0
 
YZlatCommented:
one for web service and one for process
0
 
Kinger247Commented:
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
 
Shakti109Commented:

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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.