Solved

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

Posted on 2006-11-01
5
149 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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

If you're writing a .NET application to connect to an Access .mdb database and use pre-existing queries that require parameters, you've come to the right place! Let's say the pre-existing query(qryCust) in Access takes a Date as a parameter and l…
Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

744 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now