08 April 2012

How to access Azure WCF Endpoint with CRM plugin

CRM plugin only support add service reference on run-time, which means we have to bind and generate the classes using code behind whenever we want to access it.

We can use the following sample code to create the binding in code behind.
BasicHttpBinding myBinding = new BasicHttpBinding();
myBinding.Name = "ARV.MyService";
myBinding.Security.Mode = BasicHttpSecurityMode.None;
myBinding.Security.Transport.ClientCredentialType = HttpClientCredentialType.None;
myBinding.Security.Transport.ProxyCredentialType = HttpProxyCredentialType.None;
myBinding.Security.Message.ClientCredentialType = BasicHttpMessageCredentialType.UserName;
EndpointAddress endPointAddress = new EndpointAddress("http://eea5f8cbdbc749b0bcea2b6250cbae11.cloudapp.net/Myservice.svc");
MyServiceClient client = new MyServiceClient(myBinding, endPointAddress);
client.sendSMS();

0 comments :

Post a Comment