More Information needed

Discussion in 'ASP .Net Web Services' started by Shimon Sim, Mar 2, 2005.

  1. Shimon Sim

    Shimon Sim Guest

    Hi
    I am starting using WS in my applications. So I know how to create, publish
    and consume them.
    I am bothered by a question with following scenario
    I want to create application that has WS as part of it. This application
    could be deployed on different servers that I may not be aware of.
    How can client that used one server connect to the same WS but on the other
    server without recompiling?

    What do I have to do to allow client to be tested on one server but then
    easily connect to production WS without any involvement of a developer.( End
    user could adjust URL)

    Thank
    Shimon
    Shimon Sim, Mar 2, 2005
    #1
    1. Advertising

  2. Hello Shimon,

    Quoted
    "Here's how to do it:
    Add your web reference. Go to "Solution Explorer", right click on the web
    reference name (eg. "localhost") and choose properties. In the property
    window change "Url Behavior" from "Static" to "Dynamic".

    If the web service client is a non-web application, this will automatically
    create a file name app.config with the URL to the web service.

    <appsettings>
    <add key="myapplication.mywebservice.service1"
    value="http://localhost/mywebservice/service1.asmx";
    </appsettings>

    After you comiple your client app, the configuration file of it (such as
    something.exe.config) will have the same content as the app.config.
    Now, you can deploy the configuration along with the client executable. If
    you ever need to change the web service location, you can open the
    something.exe.config file in notepad and change the value attribute.

    If the web service client is a web application such as asp.net web form,
    changing "Url Behavior" from "Static" to "Dynamic" will automatically add
    the same appsettings to web.config. Now, if you ever need to change the web
    service location, you can open web.config file in notepad and change the
    value attribute.

    For Service URLs that change more often or at runtime, you can write custom
    code to change the URL property off of the proxy class.

    e.g.

    ws.GetCustomers()
    ws.Url = CompatibleCustomerServices(2) //bind to a the next compatible
    service in the list
    ws.GetCustomers()"

    HTH
    Regards,
    Dilip Krishnan
    MCAD, MCSD.net
    dkrishnan at geniant dot com
    http://www.geniant.com

    > Hi
    > I am starting using WS in my applications. So I know how to create,
    > publish
    > and consume them.
    > I am bothered by a question with following scenario
    > I want to create application that has WS as part of it. This
    > application
    > could be deployed on different servers that I may not be aware of.
    > How can client that used one server connect to the same WS but on the
    > other
    > server without recompiling?
    > What do I have to do to allow client to be tested on one server but
    > then easily connect to production WS without any involvement of a
    > developer.( End user could adjust URL)
    >
    > Thank
    > Shimon
    Dilip Krishnan, Mar 2, 2005
    #2
    1. Advertising

  3. Shimon Sim

    Shimon Sim Guest

    Thank you.
    Shimon
    "Dilip Krishnan" <> wrote in message
    news:...
    > Hello Shimon,
    >
    > Quoted
    > "Here's how to do it:
    > Add your web reference. Go to "Solution Explorer", right click on the web
    > reference name (eg. "localhost") and choose properties. In the property
    > window change "Url Behavior" from "Static" to "Dynamic".
    >
    > If the web service client is a non-web application, this will
    > automatically
    > create a file name app.config with the URL to the web service.
    >
    > <appsettings>
    > <add key="myapplication.mywebservice.service1"
    > value="http://localhost/mywebservice/service1.asmx";
    > </appsettings>
    >
    > After you comiple your client app, the configuration file of it (such as
    > something.exe.config) will have the same content as the app.config.
    > Now, you can deploy the configuration along with the client executable. If
    > you ever need to change the web service location, you can open the
    > something.exe.config file in notepad and change the value attribute.
    >
    > If the web service client is a web application such as asp.net web form,
    > changing "Url Behavior" from "Static" to "Dynamic" will automatically add
    > the same appsettings to web.config. Now, if you ever need to change the
    > web
    > service location, you can open web.config file in notepad and change the
    > value attribute.
    >
    > For Service URLs that change more often or at runtime, you can write
    > custom
    > code to change the URL property off of the proxy class.
    >
    > e.g.
    >
    > ws.GetCustomers()
    > ws.Url = CompatibleCustomerServices(2) //bind to a the next compatible
    > service in the list
    > ws.GetCustomers()"
    >
    > HTH
    > Regards,
    > Dilip Krishnan
    > MCAD, MCSD.net
    > dkrishnan at geniant dot com
    > http://www.geniant.com
    >
    >> Hi
    >> I am starting using WS in my applications. So I know how to create,
    >> publish
    >> and consume them.
    >> I am bothered by a question with following scenario
    >> I want to create application that has WS as part of it. This
    >> application
    >> could be deployed on different servers that I may not be aware of.
    >> How can client that used one server connect to the same WS but on the
    >> other
    >> server without recompiling?
    >> What do I have to do to allow client to be tested on one server but
    >> then easily connect to production WS without any involvement of a
    >> developer.( End user could adjust URL)
    >>
    >> Thank
    >> Shimon

    >
    >
    >
    Shimon Sim, Mar 2, 2005
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. z. f.
    Replies:
    0
    Views:
    667
    z. f.
    Feb 3, 2005
  2. subrato
    Replies:
    8
    Views:
    907
    Juan T. Llibre
    Mar 14, 2006
  3. clercmedia
    Replies:
    2
    Views:
    32,239
    clercmedia
    Dec 9, 2005
  4. Michael
    Replies:
    4
    Views:
    395
    Matt Hammond
    Jun 26, 2006
  5. Robert Klemme

    With a Ruby Yell: more, more more!

    Robert Klemme, Sep 28, 2005, in forum: Ruby
    Replies:
    5
    Views:
    199
    Jeff Wood
    Sep 29, 2005
Loading...

Share This Page