Notifications
Announcements
No record found.
How to consume a web service in CRM using plugin. It would be great if some one can point me to a simple program that consumes a simple web service.
*This post is locked for comments
Hi Aaronvm,
Note that you should consider the version that you are using. If you are using CRM Online, your wcf should be hosted on Azure server.
Please download this link for consuming wcf service sample code.msdn.microsoft.com/How-to-call-External-WCF-42c4490d
Regards,
Hi Pham Hong Nghiep,
I am using the online version. I came across a similar code as shown in the link you provided but when i type it in visual Studio 2015 it gives an error saying
" 'BasicHttpBinding' does not contain a definition for 'Name' "
It gives error at 'EndpointAddress' also.
Do i have to add any specific reference?
For CRM Online, register plug-in is Isolation mode. There are some limitation for Isolation mode.
1. You cannot access external DLL (in this case, you can use ILMerge).
2. External service: You cannot not access via IP, you have to use friendly name, and your service have to be verified, in this case, you have to host your service in Azure server for testing.
You create a custom workflow activity, as the SDK describes.
In the project, create a service reference to the service that you want to consume.
Now you will have to call the service without using web.config settings. You might, for instance, save the url to the service in a custom entity.
public static void CallService(IOrganizationService organizationService) { var binding = new BasicHttpBinding { Security = new BasicHttpSecurity { Mode = BasicHttpSecurityMode.TransportCredentialOnly, Transport = new HttpTransportSecurity { ClientCredentialType = HttpClientCredentialType.Ntlm } } }; Uri uri = GetServiceUrl(organizationService); // GetServiceUrl queries to organizationService to get the Url from a record of your custom entity. var endpoint = new EndpointAddress(uri); using (var client = new MyServiceClient(binding, endpoint)) { // use the client } }
Just use Add service reference and put the service and discover then make proxy and use it.
Under review
Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.
As AI tools become more common, we’re introducing a Responsible AI Use…
We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…
These are the community rock stars!
Stay up to date on forum activity by subscribing.
SA-08121319-0 4
Calum MacFarlane 4
Alex Fun Wei Jie 2