Link to home
Start Free TrialLog in
Avatar of esko_user
esko_user

asked on

How to edit the endpoint address in reference.cs file?

Hello i have referred an web service in my client application and i want to change/override the endpoint address which is referenced. I was trying to specify the endpoint address in my reference.cs class but still this is not working. can anyone help me on this


regards
orginal reference.cs
 
public partial class HelloWorldClient : System.ServiceModel.ClientBase<sampleweb.ServiceReference1.HelloWorld>, sampleweb.ServiceReference1.HelloWorld {
        
        public HelloWorldClient() {
        }
        
        public HelloWorldClient(string endpointConfigurationName) : 
                base(endpointConfigurationName) {
        }
        
        public HelloWorldClient(string endpointConfigurationName, string remoteAddress) : 
                base(endpointConfigurationName, remoteAddress) {
        }
        
        public HelloWorldClient(string endpointConfigurationName, System.ServiceModel.EndpointAddress remoteAddress) : 
                base(endpointConfigurationName, remoteAddress) {
        }
        
        public HelloWorldClient(System.ServiceModel.Channels.Binding binding, System.ServiceModel.EndpointAddress remoteAddress) : 
                base(binding, remoteAddress) {
        }
 
I edited the web service address for this class as shown below,
 
public HelloWorldClient()
        {
        }
     //   new ServiceReference1.HelloWorldClient("HelloWorldSoapPort", "http://localhost:8080/ShowServiceA");
        public HelloWorldClient(string HelloWorldSoapPort) :
            base(HelloWorldSoapPort)
        {
        }
 
        public HelloWorldClient(string HelloWorldSoapPort, string remoteAddress) :
            base(HelloWorldSoapPort, "http://localhost:8080/ShowServiceA")
        {
        }
 
        public HelloWorldClient(string HelloWorldSoapPort, System.ServiceModel.EndpointAddress remoteAddress) :
            base(HelloWorldSoapPort, "http://localhost:8080/ShowServiceA")
        {
        }
 
        public HelloWorldClient(System.ServiceModel.Channels.Binding binding, System.ServiceModel.EndpointAddress remoteAddress) :
            base("HelloWorldSoapBinding", "http://localhost:8080/ShowServiceA")
        {
        }

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of ripahoratiu
ripahoratiu
Flag of Romania image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial