I hope this article can help you understand when you need to create a middleware between CRM system and a Legacy system/or custom application.The below example talks about the “contact” entity where the web service accepts the “lastname” attribute of it and inserts the same into CRM system. The end result is the guid which is retrieved and confirms the successful execution of the operation.
protected virtual ClientCredentials GetCredentials(string username, string password) { ClientCredentials credentials = new ClientCredentials(); credentials.UserName.UserName = username; credentials.UserName.Password = password; return credentials; }
protected virtual ClientCredentials GetDeviceCredentials() { return Microsoft.Crm.Services.Utility.DeviceIdManager.LoadOrRegisterDevice(); }
Useful links
On which event this webservice code will fire?? Please let me know how to call this webservice on a custom button click from the crm entity??
Hi Vidhu,
You can use java-script or jQuery libraries to call a web service on a button click. There are various articles available online. Also using ASP.net Ajax controls you can achieve that. For this you need to script manager and reference the asmx service.
I need to be able to call this web-service from inside the CRM 2011 online plugin. from what I understand, I cannot set service reference; I can either use basicHttp binding or call the webservice but there are some issues. could you be able to elaborate on what is the better approach?
Hi Ray,
You can still use this way of calling inside the plugin using Late binding. If you're looking for ways to add service reference, then this is what you can need to look at blogs.msdn.com/.../ssis-2008-integration-with-crm-2011-on-premise.aspx. This post is dealing with WCF way to connect CRM. Let me know if that helps!!
I encountered errors on using Microsoft.Crm.Services.Utility;
am i missing an assembly reference? thanks.
Hi mii,
If you're getting a assembly reference error, be sure of using the cs file available in SDK\samplecode\cs\helpercode\deviceIdManager.cs. Let me know if you need more help.
Apurv
Hi Apurv,
I have so for worked on development for CRM 2011 on-premise version.CRM 2011 is new to me.In case of on-premise we have all infrastructure such as windows server 2008,IIS 7 where we can deploy our own custom wcf services,we can use windows task schedular for scheduling our batch jobs,we can write custom reports using SSRS or write some SSIS batches.What are our options in case of CRM 2011 online version where we have no access to actual server machines?Client prefers online version in case he does not want to maintain any hardware/infrastructure on premise.
Correction @ above post.
CRM 2011 online is new to me**....worked on on premise version so far
Hello Apurv, I was looking at way to call the webservice from CRM ONLINE plugin but unable to find an example of late binding means by which i can invoke the webservice. I looked at your other post, but couldn't help. Can you point me? say I have webservice running at http://abc.com/webservice1. How could I reference this inside the plugin(while crm doesn't support service referencing)!