Ask a Question related to ASP.NET Web Services, Design and Development.

  1. #1

    Default Select Web Service


    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:

    internal ???????? 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.


    --
    Message posted via DotNetMonster.com
    [url]http://www.dotnetmonster.com/Uwe/Forums.aspx/dotnet-webservices/200507/1[/url]
    Glen Wilkin via DotNetMonster.com Guest

  2. Similar Questions and Discussions

    1. Select a list of items into an aliased field when doinga select
      OK I know this is going to sound weird, but I'm wondering if this is possible. I have a task table. (tblTask) These tasks can be assigned to...
    2. #25474 [Bgs]: posting arrays from a select box with multiple select is not working properly
      ID: 25474 User updated by: fmuller at cisco dot com -Summary: apache2filter: posting from a multiple select box is not...
    3. #25474 [Fbk->Opn]: posting arrays from a select box with multiple select is not working properly
      ID: 25474 User updated by: fmuller at cisco dot com Reported By: fmuller at cisco dot com -Status: Feedback...
    4. #25474 [Opn->Fbk]: posting arrays from a select box with multiple select is not working properly
      ID: 25474 Updated by: sniper@php.net Reported By: fmuller at cisco dot com -Status: Open +Status: ...
    5. SELECT DISTINCT + ORDER BY gives ERROR 145: ORDER BY items mustappear in the select list if SELECT DISTINCT is specified.
      Dan, You should be able to do this: SELECT Id, FaxID, ReceivedTime, Pages FROM ( SELECT DISTINCT .Id AS Id,
  3. #2

    Default Re: Select Web Service

    Glen Wilkin via DotNetMonster.com wrote:
    > 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:
    >
    > internal ???????? 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.
    >
    >
    Hi Glen

    From what I gather, you actually want to change the endpoint of the
    service. I assume that the two services share the exact same "contract".
    On the generated WS proxy you can change the URL behaviour property to
    "Dynamic". With this, you can change the URL (endpoint) in code, by
    setting the property on the WS proxy.

    If you wish you can encapsulate this in your own utility class,
    replacing the ?????? with the correct configured (right URL endpoint) WS
    proxy.

    Regards

    Henrik
    [url]http://websolver.blogspot.com[/url]
    Henrik Gøttig Guest

  4. #3

    Default Re: Select Web Service


    Thanks Henrik

    Sorry to be such a fool, I should have realised that.
    I only need one WS referenced and change its URL as appropriate, as you say;
    all I need to do is ensure they both meet the same 'contract'.

    Henrik Gøttig wrote:
    >> I want to be able to switch between a local test Web Service and a server
    >> based live Web Service.
    >[quoted text clipped - 23 lines]
    >>
    >> Anyone know what the ?????????s should be or if what I want is not possible.
    >
    >Hi Glen
    >
    > From what I gather, you actually want to change the endpoint of the
    >service. I assume that the two services share the exact same "contract".
    >On the generated WS proxy you can change the URL behaviour property to
    >"Dynamic". With this, you can change the URL (endpoint) in code, by
    >setting the property on the WS proxy.
    >
    >If you wish you can encapsulate this in your own utility class,
    >replacing the ?????? with the correct configured (right URL endpoint) WS
    >proxy.
    >
    >Regards
    >
    >Henrik
    >[url]http://websolver.blogspot.com[/url]
    --
    Glen


    Message posted via [url]http://www.dotnetmonster.com[/url]
    Glen Wilkin via DotNetMonster.com Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139