Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Add a web reference to a web service during run-time

Status
Not open for further replies.

steve1rm

Programmer
Aug 26, 2006
255
GB
Hello

I have a PDA application that has been developed using VB 2005 smart device.

The PDA has been designed to access a web service and download data from a database that the web service can access.

However, the user will not know the location of web reference of the web service until after they install the PDA.

So the web reference will have to be configured when the user starts the PDA application. The user might also want to configure the PDA to use another web service so this will have to be configured to change web services.

Before I used VS to add the web reference during development. However, this cannot be done now as only the user will know what web service to connect to.

Is there any method that can be used to add a web reference during the run-time of the PDA application, and change to another web service?

Many thanks for any suggestions,

Steve
 
Hello,

I not sure that will work.

The PDA application should be able to connect to any web service and use the web methods in that service.

The reason is that if the web server where the web service is being hosted is move to another server, the user should be able to enter the new url in a text box and should be able to connect and consume the services.

Many thanks for any suggestions,

Steve
 
If you add the Web Reference to your project as normal, then when you create a New instance of the reference ('Dim mwf As New MyWebRef.MyClass') change the Url to the new location:

Code:
Dim mwf As New MyWebRef.MyClass

mwf.Url = "[URL unfurl="true"]http://anotherserver.com/MyWebRef"[/URL]

...

I think that this works,
 
Hello,

I will give that a try and let you know.

Thanks for your reply,

Steve
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top