Results 1 to 4 of 4

Thread: How to reference and call a webservice?

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Jun 2007
    Posts
    241

    Thumbs up How to reference and call a webservice?

    Hello friends

    I'm using: VS.NET 2005

    I have a webservice1.Service1. I have installed it on IIS. No problem.

    I can access it through:
    http://localhost/WebService1/Service1.asmx
    or
    http://192.168.1.109/WebService1/Service1.asmx

    At my ASP.net application, I have referenced WebService1 as web
    reference and on its window properties I have set up:
    URL Behavior = Dynamic

    On the web.config of the ASP.net application is stated:
    <appSettings><add key="MyApplication.localhost.WebService1"
    value="http://localhost/WebService1/Service1.asmx"/>
    </appSettings>

    On an aspx page, I call the webservice in this way:

    Imports MyApplication.localhost
    .....
    Dim ws As New WebService1.Service1
    Dim sMess As String = ws.HelloWorld

    My question is: If I need to install the webservice in other server,
    how could I reference it on my ASP.NET Application?

    a. If I change the webservice to server 192.168.1.200, should I change
    on the web.config:
    <appSettings><add key="MyApplication.localhost.WebService1"
    value="http://192.168.1.200/WebService1/Service1.asmx"/>
    </appSettings>
    b. How could I get this
    value="http://192.168.1.200/WebService1/Service1.asmx" ?
    On my ASP.NET app is stated:
    Imports MyApplication.localhost

    Is it possible to change the value on the web.config and not to change
    anything on the aspx.vb ?

    Thanks
    Failing to plan is Planning to fail

  2. #2
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Re: How to reference and call a webservice?

    That's correct - when your service moves to a production box, all you need to do is change the URL in the config file and you're good to go. No code changes required.

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Jun 2007
    Posts
    241

    Re: How to reference and call a webservice?

    thanks dude.
    Failing to plan is Planning to fail

  4. #4
    PowerPoster gep13's Avatar
    Join Date
    Nov 2004
    Location
    The Granite City
    Posts
    21,963

    Re: How to reference and call a webservice?

    Hey,

    If your question has been answered, can you remember to mark it resolved?

    Thanks

    Gary

Posting Permissions

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



Click Here to Expand Forum to Full Width