JMO9966
asked on
How to pass a string value to: localhost.IDataCollectionservice()
Hello,
I have an App I wrote that needs to be dynamic in the localhost.IDataCollections ervice() I use for each install.
Private ws As New localhost.IDataCollections ervice()
ws.Url = "http://fs011/datacollection/isapi_dcwebservice.dll/soap/IDataCollection"
I have a function that will retrieve a filepath string, but I need to send this result into the following web service definition for it's URL path. Here's an example of two paths for two different machines. I need to insert the machine name and folder into this URL definition setting.
What I need to be dynamic is the macine name(fso11 and morr-2 in the two paths below) as well as the folder names where the web service is installed (DataCollection and Training in my two samples).
ws.Url = "http://fs011/datacollection/isapi_dcwebservice.dll/soap/IDataCollection"
'ws.Url = "http://morr-2/Training/isapi_dcwebservice.dll/soap/IDataCollection"
Thanks,
JMO9966
I have an App I wrote that needs to be dynamic in the localhost.IDataCollections
Private ws As New localhost.IDataCollections
ws.Url = "http://fs011/datacollection/isapi_dcwebservice.dll/soap/IDataCollection"
I have a function that will retrieve a filepath string, but I need to send this result into the following web service definition for it's URL path. Here's an example of two paths for two different machines. I need to insert the machine name and folder into this URL definition setting.
What I need to be dynamic is the macine name(fso11 and morr-2 in the two paths below) as well as the folder names where the web service is installed (DataCollection and Training in my two samples).
ws.Url = "http://fs011/datacollection/isapi_dcwebservice.dll/soap/IDataCollection"
'ws.Url = "http://morr-2/Training/isapi_dcwebservice.dll/soap/IDataCollection"
Thanks,
JMO9966
ASKER
Thanks I run 2005 and am not clear on which of your code snippets to use and which to ignore.
I will check the Dynamic property you referred to.
Thanks,
JMO9966
I will check the Dynamic property you referred to.
Thanks,
JMO9966
With Url Behavior = Dynamic, you won't have to use code at all. The generated file will automatically read the URL from the .config file.
ASKER
Thanks, how do I set the URL to Dynamic?
JMO9966
JMO9966
Click on the Web Reference in the Project Explorer window. Now in the properties window, you'll see the "Url Behavior" property dropdown. Change it to "Dynamic" Now you'll be able to change the value in your app.config file.
ASKER
Okay, my Web Reference as set to Dynamic.
Now I'm wondering how to changd the value in my App.config file. I see your code with Get value.
Seems to be that I will first Set and then Get, but I'll have to figure out how to Set the value too.
Dim Machine As String = Configuration.Configuratio nSettings. AppSetting s.Set("mac hine")
Dim Folder As String = Configuration.Configuratio nSettings. AppSetting s.Set("fol der")
ws.Url = String.Format("http://{0}/{1}/isa pi_dcwebse rvice.dll/ soap/IData Collection ", Machine, Folder)
Am I on the right track?
Thanks,
JMO9966
Now I'm wondering how to changd the value in my App.config file. I see your code with Get value.
Seems to be that I will first Set and then Get, but I'll have to figure out how to Set the value too.
Dim Machine As String = Configuration.Configuratio
Dim Folder As String = Configuration.Configuratio
ws.Url = String.Format("http://{0}/{1}/isa
Am I on the right track?
Thanks,
JMO9966
ASKER
Increasing points too.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thank You!
I'll give that a try.
JMO9966
I'll give that a try.
JMO9966
If VS 2003, you can still save and load from App.Config, but you will need to use appSettings:
Add a new item to your project and select the type "Application Configuration"
Edit the new App.Config so that you have the following information:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<appSettings>
<add key="machine" value="fs011" />
<add key="folder" value="datacollection" />
</appSettings>
</configuration>
Now you can use code like the following:
Open in new window