How to change the URL consuming a Webservice?

1

I have a Webservice written in C # and the client application (data collectors).

Collectors consume Webservice to query information in the main DB. In each client I install my WebService (Data Server) has a different IP.

How can I parameterize client applications (collectors) via code to consume Webservice on a different IP than I used to add Web References?

Is there any way to change via IP code to search the WebService?

Eg:

MeuWS objColetar = new MeuWS();
objColetar.URL = novoIP;
objColetar.FuncaoColetar(param1, param2);
    
asked by anonymous 01.02.2014 / 13:37

2 answers

1

Try the following:

MeuWS objColetar = new MeuWS();
objColetar.Endpoint.Address = new System.ServiceModel.EndpointAddress(novoIP); // por exemplo, http://129.135.145.177:8080
objColetar.FuncaoColetar(param1, param2);
    
02.02.2014 / 05:49
0

Try this:

ServiceReferenceAbrasfV201.nfseClient wsClient = 
        new ServiceReferenceAbrasfV201.nfseClient("nfseSOAP1", EnderecoWebService);
    
05.02.2014 / 13:39