Last post Mar 10, 2014 01:29 PM by pathivinay1
Mar 10, 2014 11:26 AM|pathivinay1|LINK
I need to call a WCF service from my code.
The reason is , we are having n number of servers and my server name in my url is different for each server.
In that situation i prefer to consume the service from code as i have to create the url dynamically to call the service.
I will be using wsHttpBinding and the service will be hosted on IIS
Mar 10, 2014 11:55 AM|Blast_Dan|LINK
The generate code should createa a ServiceClient class.
This class should take a binding and an EndpointAddress.
For WsHttpBinding you can create the following class
You can then create an EndpointAddress
Then load it into your Service client like the following
WSHttpBinding binding = new WSHttpBinding(SecurityMode.None);
EndpointAddress address = new EndpointAddress("www.myendpointaddress.com");
ServiceClient client = new ServiceClient(binding, address);
Mar 10, 2014 01:29 PM|pathivinay1|LINK