Dynamic Web Service address

Last post 07-04-2009 9:17 AM by johnwsaunders3. 7 replies.

Sort Posts:

  • Dynamic Web Service address

    06-30-2009, 11:25 AM
    • Member
      1 point Member
    • rfm8
    • Member since 06-30-2009, 3:02 PM
    • Posts 4

    Hello all!


    I need your kindly help for the next issue:

    I have a site. let's consider it's address as: http://wwww.hoster.com/Ron/

    all the site forms are in this directory.

    The site should use a Web Service.

    The web service located in the directory: http://wwww.hoster.com/Ron/WS/

    In the future I'll want to move the site to another server. the new address will be for example: http://www.newhoster.com/Kevin/

    And the Web Service will be in http://www.newhoster.com/Kevin/WS/


    How can i configure the web.config keys and all the soap address location at the discomap file and the wsdl file, so they will be changed without changing all those files manually.

    the option of http://localhost:80/Ron/WS/ is helpless because the "Ron" directory should be also dynamic.


    What should I do?


    Thank you all.


  • Re: Dynamic Web Service address

    06-30-2009, 1:23 PM

    I believe you can set the Url property of the webservice location programmatically.  So if you have a key in your web.config, which points to the locaiton of your webservice, then all you wuold have to do is update this key and you'll be good to go.

  • Re: Dynamic Web Service address

    06-30-2009, 4:51 PM
    • Member
      1 point Member
    • rfm8
    • Member since 06-30-2009, 3:02 PM
    • Posts 4

    What should I do if I want that the web server address that configured in the XML of the wsdl and the discomap will be taken from the web.config?

    The situation now is that the address copied serval times: to the discomap, to the wsdl and to the web.config.

    I want that the configuration will be only at the web.config file.

  • Re: Dynamic Web Service address

    06-30-2009, 9:11 PM

    I believe that, at runtime, only the URL in the web.config will be used.

    John Saunders
  • Re: Dynamic Web Service address

    07-01-2009, 7:02 AM
    • Member
      1 point Member
    • rfm8
    • Member since 06-30-2009, 3:02 PM
    • Posts 4

    I've checked and unfortunatly it's not...

  • Re: Dynamic Web Service address

    07-04-2009, 4:32 AM

    Please be specific. Which URL is being used from somewhere other than web.config, and how do you know?

    John Saunders
  • Re: Dynamic Web Service address

    07-04-2009, 5:05 AM
    • Member
      1 point Member
    • rfm8
    • Member since 06-30-2009, 3:02 PM
    • Posts 4

    Hi

    For example, this url is used in the web.config:

    <add key="Service1" value="http://www.hoster.com/Ron/WS/Service1.asmx"/>

    this in the *.discomap file:

        <DiscoveryClientResult referenceType="System.Web.Services.Discovery.DiscoveryDocumentReference" url="http://misasp.hevra.haifa.ac.il/ronetgar/AnswerService.asmx?disco" filename="Service1.disco" />
        <DiscoveryClientResult referenceType="System.Web.Services.Discovery.ContractReference" url="http://misasp.hevra.haifa.ac.il/ronetgar/AnswerService.asmx?wsdl" filename="AnswerService.wsdl" />

        <DiscoveryClientResult referenceType="System.Web.Services.Discovery.DiscoveryDocumentReference" url="http://www.hoster.com/Ron/WS/Service1.asmx?disco" filename="Service1.disco" />

        <DiscoveryClientResult referenceType="System.Web.Services.Discovery.ContractReference" url="http://www.hoster.com/Ron/WS/Service1.asmx?wsdl" filename="Service1.wsdl" />

    and this is in the *.wsdl file:

      <wsdl:service name="Service1">

        <wsdl:port name="Service1Soap" binding="tns:Service1Soap">

          <soap:address location="http://www.hoster.com/Ron/WS/Service1.asmx" />

        </wsdl:port>

        <wsdl:port name="Service1Soap12" binding="tns:Service1Soap12">

          <soap12:address location="http://www.hoster.com/Ron/WS/Service1.asmx" />

        </wsdl:port>

        <wsdl:port name="Service1HttpGet" binding="tns:Service1HttpGet">

          <http:address location="http://www.hoster.com/Ron/WS/Service1.asmx" />

        </wsdl:port>

        <wsdl:port name="Service1HttpPost" binding="tns:Service1HttpPost">

          <http:address location="http://www.hoster.com/Ron/WS/Service1.asmx" />

        </wsdl:port>

      </wsdl:service>


    This site should be disigned for every server and not for the specific one.

    I want that in the future, each person will can take all the files of the site with the WS directory andf put it in every server he wants. In this situation, the site sould recognize by himself the current directory that he is located in, and to use the Web Service that is located in the ~/WS directory.


    Thanks!

  • Re: Dynamic Web Service address

    07-04-2009, 9:17 AM
    Answer

    What I meant is that only one of those URLs matters. Here's an experiment to try: one at a time, change each of those URLs to point to a host that does not exist. Change them to point to http://NOWHERE/. Then build and run the application.

    Tell us which of those changes resulted in a change in your application.

    John Saunders
Page 1 of 1 (8 items)