|
-
Dec 29th, 2009, 02:46 AM
#1
Thread Starter
Addicted Member
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 
-
Dec 29th, 2009, 05:31 AM
#2
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.
-
Dec 29th, 2009, 07:48 AM
#3
Thread Starter
Addicted Member
Re: How to reference and call a webservice?
Failing to plan is Planning to fail 
-
Dec 29th, 2009, 01:32 PM
#4
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|