How do I perform CRUD operations with Dynamics 365 CRM online using BizTalk 2016

Lee Sitton 1 Reputation point
2021-12-14T11:56:46.023+00:00

I am able to create/update/delete records in Dynamics 365 Online as well as retrieve data too using BizTalk 2016. However, this is using CRMOnline authentication and a custom endpoint behaviour.

As Microsoft have deprecated the CRMOnline authentication method, I need to be able to do the same using OAuth 2.0 but I cannot find any documentation to show how to create a custom BizTalk endpoint behaviour to handle this.

The Dynamics 365 SDK provides a set of schemas, the one of most interest appears to be OrganizationService_schemas_microsoft_com_xrm_2011_Contracts_Services.xsd but I do not know how to create a message that conforms to this schema and utilises OAuth 2.0.

Please can someone help?

Microsoft BizTalk Server
Microsoft BizTalk Server
A family of Microsoft server products that support large-scale implementation management of enterprise application integration processes.
341 questions
{count} votes

2 answers

Sort by: Most helpful
  1. Colin Dijkgraaf 1,346 Reputation points
    2021-12-15T06:45:31.417+00:00

    OAuth is just a matter of calling another endpoint with credentials and getting a bearer token that is valid for a certain time and injecting that into the headers of the actual request.

    See this blog article Calling the Force.com REST API from BizTalk Server, now only available in the Internet Archive Way Back Machine, that detailed how to do it for Salesforce OAuth. Note that different systems have implemented OAuth slightly differently including whether to use basic auth initially, or to use a secret key to get the token. Also how the OAuth token expires can differ, some will only expire after a fixed time, whereas others will also expire a token whenever you request a new one. So you need to determine how the OAuth you are connecting to behaves and amend the code accordingly. You can initially just write a Class that you can call from a test class to get the OAuth part working, before you inject that into the WCF End Point Behaviour.

    I've taken that OAuth behaviour and amended it so that it gets the password/secret from a SSO Affiliate Application rather than from the Send Port Configuration, also making the OAuth URL configurable, and have also created a copy with amendments for another systems which had different credential and token expiry requirements.

    Update, same author published this Calling the Force.com REST API from BizTalk Server - Multiple Endpoints

    0 comments No comments

  2. Lee Sitton 1 Reputation point
    2021-12-15T07:33:05.027+00:00

    Hi ColinDijkgraaf

    That is very helpful and I have successfully got my endpoint behaviour to retrieve an OAuth token on demand as well as injecting it in to the header of the the request. My difficulty now is how to modify the end point behaviour to wrap the SOAP request with an appropriate envelope.

    I'll work through the blog you've mentioned and will see how far I get.

    Thanks again for your support.

    0 comments No comments