You can also do what the "Service Reference" code generated
public class ServiceXClient : ClientBase<IServiceX>, IServiceX { public ServiceXClient() { } public ServiceXClient(string endpointConfigurationName) : base(endpointConfigurationName) { } public ServiceXClient(string endpointConfigurationName, string remoteAddress) : base(endpointConfigurationName, remoteAddress) { } public ServiceXClient(string endpointConfigurationName, EndpointAddress remoteAddress) : base(endpointConfigurationName, remoteAddress) { } public ServiceXClient(Binding binding, EndpointAddress remoteAddress) : base(binding, remoteAddress) { } public bool ServiceXWork(string data, string otherParam) { return base.Channel.ServiceXWork(data, otherParam); } }
Where IServiceX is your WCF Service Contract
Then your client code:
var client = new ServiceXClient(new WSHttpBinding(SecurityMode.None), new EndpointAddress("http://localhost:911")); client.ServiceXWork("data param", "otherParam param");
joseph.l.hunsaker Feb 20 '15 at 0:26 2015-02-20 00:26
source share