No Touch Deployment and Web Services.

M

Mats-Erik Grundh

No Touch Deployment and Web Services.

How do you programatically configure wich server to
access?

My environment:
- Locahost.
- Test server.
- Production server.

My problem is that same webservice deploys on localhosts,
development server, test server and production server and
i want to control from the shortcut on the desktop, or
som other way, on
which server to access webservice from, like this:

C:\WINNT\Microsoft.NET\Framework\v1.1.4322\IEExec.exe
http://ozzy/conet/client/bin/co.win.exe?server=ozzy

the parameter server=ozzy tells which server to run
webservice on.

PS:I've tested the option dynamic on web reference
properties but i cant find a way to programatically
change
the settings in application.config file.

Thanks in advance!
 
R

Ricardo Pereira

On your client application use the url property of the generated proxy,
like:

public class Math : System.Web.Services.Protocols.SoapHttpClientProtocol
..... (Generated by Reference import)


your app:

Math m=new Math();
m.Url="your url here"

...

m.YourRemoteMethod();

best regards
ricardo
 
M

Mats-Erik Grundh

I don't think it's a possible solution beacause we have a
huge application with many calls to different webservices
(on same server) and i'ts not reliable to use the URL
property in your code if the developer forgot to write the
url before the call.
 
¥

¥xÆW·L³n§Þ³N³B¤ä´©³¡

You may modify the config file before call the web service, for example:

Dim doc As New XmlDocument

doc.Load("WindowsApplication2.exe.config")

Dim n As XmlNode

n =
doc.DocumentElement.SelectSingleNode("/configuration/appSettings/add[@key='W
indowsApplication2.localhost.Service1'] ")



n.Attributes(1).InnerXml =
"http://AppServer/WebService1/Service1.asmx"

doc.Save("WindowsApplication2.exe.config")

doc = Nothing

Dim o As New localhost.Service1

MsgBox(o.GetString)


This will change the web service's url dynamically.

Luke
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
 
M

Mats-Erik Grundh

I don't think it's a possible solution beacause we have a
huge application with many calls to different webservices
(on same server) and i'ts not reliable to use the URL
property in your code if the developer forgot to write the
url before the call.
 
M

MSFT

When we redirect a web service, there may two ways:

1. Modify its url in code
2. Specify its url in config file.

Since your appliaction was executed thhorugh IEexec, it is hard to modify
config file on the web server. Therefore, the only resort is achieving this
in code. If we have a better design in the code, for example, when
developer need to call a web service, he need to call a public method:


Dim webobj= GetWebServiceObject()

Public Function GetWebServiceObject() as Server1.Service1


Dim o As New Server1.Service1
o.Url = strWebServiceUrl

return o

End Function

Luke
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
 
M

MSFT

This message may be posted incorrectly by KEN. From his information, it is
not related to this topic.

Luke
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,995
Messages
2,570,226
Members
46,815
Latest member
treekmostly22

Latest Threads

Top