Using Webservices in Dynamics CRM plug-ins


Sometimes you need calling a web service inside a plugin, like a scenario we encountered. We need a plugin for an activity Status change event, which calls a web service out side of the CRM server. In this situations if you add a web service reference in plug-in code in visual studio and deploying it to CRM server, it would not work using the config items in App.config.

What is the solution ?

You should manually config the web service, I mean hard code it like below :

BasicHttpBinding binding = new BasicHttpBinding();
EndpointAddress endpoint = new EndpointAddress("http://webservice?wsdl");
var webserviceClient= new WEbServiceClient(binding, endpoint);


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s