Web References in code

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • John Smith

    Web References in code

    Hi

    I've only started "playing" with web services this weekend. I have one
    question which I can't seem to find an solution to...

    Is there a way to change the (web) server's name on which your web service
    is running programatically ? Let say I develop the web service on my
    localhost but then I want to deploy it on a company's intranet - the server
    hosting the web service will change. How can I during runtime enter the name
    of the server hosting the webservice and then use/connect to it?

    I hope I'm making sense. Any help would be great.

    Francois


  • Anand [MVP]

    #2
    RE: Web References in code

    Look at the URL property of the proxy that your web reference created for you. Just change it to whatever is the correct server name when you deploy to production, or even better read it off a config file.

    Rgds,
    Anand
    VB.NET MVP


    "John Smith" wrote:
    [color=blue]
    > Hi
    >
    > I've only started "playing" with web services this weekend. I have one
    > question which I can't seem to find an solution to...
    >
    > Is there a way to change the (web) server's name on which your web service
    > is running programatically ? Let say I develop the web service on my
    > localhost but then I want to deploy it on a company's intranet - the server
    > hosting the web service will change. How can I during runtime enter the name
    > of the server hosting the webservice and then use/connect to it?
    >
    > I hope I'm making sense. Any help would be great.
    >
    > Francois
    >
    >
    >[/color]

    Comment

    • John Smith

      #3
      Re: Web References in code

      Sorry but, huh? Where do I find the "URL property of the proxy that your web
      reference created"? In the WinApplication somewhere right? I looked through
      the code generated by VB it doesn't seem to be there...

      I apoligise for asking a seemingly stupid question...

      Francois


      "Anand [MVP]" <Anand [MVP]@discussions.mi crosoft.com> wrote in message
      news:A9078648-33D2-4DDD-9599-01201CFE272B@mi crosoft.com...[color=blue]
      > Look at the URL property of the proxy that your web reference created for[/color]
      you. Just change it to whatever is the correct server name when you deploy
      to production, or even better read it off a config file.[color=blue]
      >
      > Rgds,
      > Anand
      > VB.NET MVP
      > http://www.dotnetindia.com
      >
      > "John Smith" wrote:
      >[color=green]
      > > Hi
      > >
      > > I've only started "playing" with web services this weekend. I have one
      > > question which I can't seem to find an solution to...
      > >
      > > Is there a way to change the (web) server's name on which your web[/color][/color]
      service[color=blue][color=green]
      > > is running programatically ? Let say I develop the web service on my
      > > localhost but then I want to deploy it on a company's intranet - the[/color][/color]
      server[color=blue][color=green]
      > > hosting the web service will change. How can I during runtime enter the[/color][/color]
      name[color=blue][color=green]
      > > of the server hosting the webservice and then use/connect to it?
      > >
      > > I hope I'm making sense. Any help would be great.
      > >
      > > Francois
      > >
      > >
      > >[/color][/color]


      Comment

      • Anand[MVP]

        #4
        Re: Web References in code

        When you refernce a webservice, a proxy is created for you by VS.NET. When you say dim a as webservice, you are referencing that proxy. Just look for the URL property in a.

        Rgds,
        Anand
        VB.NET MVP


        "John Smith" wrote:
        [color=blue]
        > Sorry but, huh? Where do I find the "URL property of the proxy that your web
        > reference created"? In the WinApplication somewhere right? I looked through
        > the code generated by VB it doesn't seem to be there...
        >
        > I apoligise for asking a seemingly stupid question...
        >
        > Francois
        >
        >
        > "Anand [MVP]" <Anand [MVP]@discussions.mi crosoft.com> wrote in message
        > news:A9078648-33D2-4DDD-9599-01201CFE272B@mi crosoft.com...[color=green]
        > > Look at the URL property of the proxy that your web reference created for[/color]
        > you. Just change it to whatever is the correct server name when you deploy
        > to production, or even better read it off a config file.[color=green]
        > >
        > > Rgds,
        > > Anand
        > > VB.NET MVP
        > > http://www.dotnetindia.com
        > >
        > > "John Smith" wrote:
        > >[color=darkred]
        > > > Hi
        > > >
        > > > I've only started "playing" with web services this weekend. I have one
        > > > question which I can't seem to find an solution to...
        > > >
        > > > Is there a way to change the (web) server's name on which your web[/color][/color]
        > service[color=green][color=darkred]
        > > > is running programatically ? Let say I develop the web service on my
        > > > localhost but then I want to deploy it on a company's intranet - the[/color][/color]
        > server[color=green][color=darkred]
        > > > hosting the web service will change. How can I during runtime enter the[/color][/color]
        > name[color=green][color=darkred]
        > > > of the server hosting the webservice and then use/connect to it?
        > > >
        > > > I hope I'm making sense. Any help would be great.
        > > >
        > > > Francois
        > > >
        > > >
        > > >[/color][/color]
        >
        >
        >[/color]

        Comment

        • John Smith

          #5
          Re: Web References in code

          Got it. thanks!

          "Anand[MVP]" <AnandMVP@discu ssions.microsof t.com> wrote in message
          news:AD8CB720-14CB-422F-B360-30F717AF5A09@mi crosoft.com...[color=blue]
          > When you refernce a webservice, a proxy is created for you by VS.NET. When[/color]
          you say dim a as webservice, you are referencing that proxy. Just look for
          the URL property in a.[color=blue]
          >
          > Rgds,
          > Anand
          > VB.NET MVP
          > http://www.dotnetindia.com
          >
          > "John Smith" wrote:
          >[color=green]
          > > Sorry but, huh? Where do I find the "URL property of the proxy that your[/color][/color]
          web[color=blue][color=green]
          > > reference created"? In the WinApplication somewhere right? I looked[/color][/color]
          through[color=blue][color=green]
          > > the code generated by VB it doesn't seem to be there...
          > >
          > > I apoligise for asking a seemingly stupid question...
          > >
          > > Francois
          > >
          > >
          > > "Anand [MVP]" <Anand [MVP]@discussions.mi crosoft.com> wrote in message
          > > news:A9078648-33D2-4DDD-9599-01201CFE272B@mi crosoft.com...[color=darkred]
          > > > Look at the URL property of the proxy that your web reference created[/color][/color][/color]
          for[color=blue][color=green]
          > > you. Just change it to whatever is the correct server name when you[/color][/color]
          deploy[color=blue][color=green]
          > > to production, or even better read it off a config file.[color=darkred]
          > > >
          > > > Rgds,
          > > > Anand
          > > > VB.NET MVP
          > > > http://www.dotnetindia.com
          > > >
          > > > "John Smith" wrote:
          > > >
          > > > > Hi
          > > > >
          > > > > I've only started "playing" with web services this weekend. I have[/color][/color][/color]
          one[color=blue][color=green][color=darkred]
          > > > > question which I can't seem to find an solution to...
          > > > >
          > > > > Is there a way to change the (web) server's name on which your web[/color]
          > > service[color=darkred]
          > > > > is running programatically ? Let say I develop the web service on my
          > > > > localhost but then I want to deploy it on a company's intranet - the[/color]
          > > server[color=darkred]
          > > > > hosting the web service will change. How can I during runtime enter[/color][/color][/color]
          the[color=blue][color=green]
          > > name[color=darkred]
          > > > > of the server hosting the webservice and then use/connect to it?
          > > > >
          > > > > I hope I'm making sense. Any help would be great.
          > > > >
          > > > > Francois
          > > > >
          > > > >
          > > > >[/color]
          > >
          > >
          > >[/color][/color]


          Comment

          Working...