|
-
Jul 22nd, 2005, 03:42 AM
#1
Thread Starter
Hyperactive Member
Web Service as function return value [RESOLVED]
I want to be able to switch between a local test Web Service and a server
based live Web Service.
When testing numerous web forms I need to switch their Web Service reference between a local development service and the live one.
At the moment this involves replacing the declaration 'TestWebService' with 'LiveWebService' in each form.
What I would like to do is have a utilities class that has a static function
that returns a reference to the appropriate web service depending upon a key
in web.config.
I would be able to do this if I knew how to declare the return value of the
function:
Code:
internal static ???????? GetWebService()
{
string lstrWebService =
ConfigurationSettings.AppSetting["WebService"].ToString();
if(lstrWebService == "Test")
{
return ????????;
}
else
{
return ????????;
}
}
Anyone know what the ?????????s should be or if what I want is not possible.
Last edited by GlenW; Jul 22nd, 2005 at 05:03 AM.
-
Jul 22nd, 2005, 04:49 AM
#2
Re: Web Service as function return value
What do you mean by returning a "a reference to the appropriate web service"? Can you show me an example?
-
Jul 22nd, 2005, 05:02 AM
#3
Thread Starter
Hyperactive Member
Re: Web Service as function return value
 Originally Posted by mendhak
What do you mean by returning a "a reference to the appropriate web service"? Can you show me an example?
I've got 2 Web Services referenced and I wanted to switch between them, but I now realise that this is totally the wrong way to do it!!!
I'm going to have only one service referenced and change its URL when necessary. All I need to do is ensure that the services maintain the same contracts.
A real blonde moment, or moments 'cos I've been doing it wrong for ages.
-
Jul 22nd, 2005, 05:17 AM
#4
Re: Web Service as function return value [RESOLVED]
I was thinking along the same lines but your initial post confused me (with the Return values). The only thing that did require changing, as you've seen, was the .URL property...
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|