1
votes

It seems that I am not alone struggling to find any good Microsoft resource/guide/article on how to consume CRM WebAPI from Java. We are using an on-premise CRM deployment and I am trying to understand if I am on the right track on this or if I am missing something.

To start with, I am following the approach discussed in this MSDN article and this helpful post by Jason on how to connect to CRM Web Services using OAuth from any Java client. I have two questions with this approach:

  1. It seems that this approach is targeted for CRM Online version since it requires the CRM application to be registered with Azure AD as a pre-requisite (which wont be the case with an on-premise solution). Any ideas on how to achieve this for an on-premise CRM?

  2. Also, this approach requires us to pass an Authority URL for the connection to be made but I am not sure where to get this URL from? I tried creating the Authority URL based on the format mentioned in this MSDN article but it doesn't seem to work. The Authority URL should look something like this: https:///adfs/ls). Is there any configuration/setting change required for this?

Any help or direction would be appreciated.

1
have a look at this post: stackoverflow.com/questions/41739777/… - In any case, you don't need special libraries for Java to authenticate, it is possible to authenticate by sending a HTTP POST with the necessary data in JSON format. Have a look at how that should look like in Colin's answer here: community.dynamics.com/crm/f/117/t/212493 - bear in mind that it is for CRM Online but it might work for on premise as well if everything is set up correctlyKenci

1 Answers

0
votes

An elaborate tutorial on connecting from Java to MS Dynamics, with OAuth2 authentication from Java via ADFS (Microsoft), is available here. The Java library OLingo is used to read objects (EntitySets) via the OData-interface from 'Dynamics' into Java classes.