Calling a WCF Service in MS CRM 2011


One of excited future of WCF service is execute a WCF service by custom code. This future is very helpful to call WCF Service in MS CRM 2011 plug-in.
We can use BasicHttpBinding concept of WCF.
Code :
 BasicHttpBinding binding = new BasicHttpBinding();
 binding .Name = "BasicHttpBinding";
 binding .Security.Mode = BasicHttpSecurityMode.None;
 binding .Security.Transport.ClientCredentialType = HttpClientCredentialType.None;
 binding .Security.Transport.ProxyCredentialType = HttpProxyCredentialType.None;
 binding .Security.Message.ClientCredentialType =  
                                                 BasicHttpMessageCredentialType.UserName;
 EndpointAddress endPointAddress = new EndpointAddress(“your WCF Service URL”);

using (ServiceClient holidayService = new ServiceClient(binding, endPointAddress))
{
//Required Code
}

Comments

Popular posts from this blog

MS CRM 4.0 Relationship Mappings Error

Open Data Protocol

Using Read-only versus const