Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

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

Posted on 2006-11-01
5
Medium Priority
?
193 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 2000 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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…
Whether it be Exchange Server Crash Issues, Dirty Shutdown Errors or Failed to mount error, Stellar Phoenix Mailbox Exchange Recovery has always got your back. With the help of its easy to understand user interface and 3 simple steps recovery proced…

772 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