Synchronization between Sitecore Commerce catalog and Dynamics AX does not work

Sync-icon


Cool sync icon by Tooschee under CC BY-NC license

Hey there.

After years of refusing myself to blog about my job, I finally decided to share some things that may be useful to others, and of course what better way to start than talking about my platform of choice and a problem that may take days to troubleshoot.

So, let’s get to the point. For some reason, despite all your efforts, your goal of making a successful sync from AX into Commerce seems far, far away.

You have already installed Sitecore, of course. You also have installed and configured your local instance of Sitecore Commerce. You have installed the Commerce Connector, and all of the necessary packages, merged all config files, and finally downloaded, opened and compiled the Routing Framework SDK flawlessly.

Then you run the console app – and nothing. Nothing but exceptions, that is.

Then you go and check Hao Liu’s excellent post about this topic, and then the one about the changes in Update-1. You realize that you should have checked Hao Liu’s blog before, but hey, no harm done, you check that all is ok, and follow his advice.

Still nothing but exceptions.

Don’t despair, there are still some things you can check.

-“Help! the console app throws a gross exception about a task that wasn’t completed, or something”

-Ok. First thing to check is that you have access to the Retail database and to the Dynamics Realtime service. Make sure your dev machine can connect to the SQL server and the database, and that the user that you specified (or the logged-in user, in case of a trusted connection) have the necessary permissions there. Also, check the channel ID of course.

-“I did! but I still see the same task something something exception. But now it says ‘Not Found’ too!”

-Ok, sit down, grab a cup of coffee and relax a bit. When you regain your coolness, go and open IIS manager. Make sure that you have a binding for accessing your Sitecore instance via https. It’s absolutely necessary, since the sync process depend on this. Also, double-check that you point to that binding in the console app’s config file. (BTW, it doesn’t hurt to check the username/password combination either).

-“OMG – Something happened. I can see that the route starts, but it blows up after a couple of seconds and the sync process still does nothing but explode with those weird exceptions”

-First of all, no exception is weird (although I could be proven wrong if for some reason the next .Net framework version comes with a WeirdException class). Second, chances are that you are seeing references to the SitecoreWebApi methods in the stack trace shown. If so, a little jewel that took me a long time to find may be the culprit.

Go and check your web config – search and find this tag (if your site runs on IIS):

<add name="ExtensionlessUrlHandler-Integrated-4.0"...../>

Or this tag (if your site runs on IIS Express):

<add name="ExtensionlessUrl-Integrated-4.0"...../>

Make sure that you have PUT, DELETE and PATCH as accepted verbs for the handler. For instance:

  <add name="ExtensionlessUrlHandler-Integrated-4.0" path="*." verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS" type=...... />

That’s it.

-“It works now! Is this magic? Are you some kind of wizard?”

Well, it is, but not that kind of magic. And yes, I am, just not that kind of wizard.

Turns out that Sitecore Web Api (or, in newer versions, Sitecore Client Services , which is a layer on top of it) require these verbs (BTW, not sure about the DELETE one, but in a dev machine I assume it’s safe to add it) to perform edit/update operations on the content tree, and the processors in charge of performing the sync tasks need to change fields like the last run date and others.

With the setting you just changed, you told IIS that there are handlers that do not have an extension (i.e. Sitecore Web Api stuff) that will handle such verbs. Before you changed this, IIS was just not letting the requests go through. Therefore, you got a Not Found (i.e. a 404 error) message somewhere.

There you go, some reading material and hopefully one or two things that could save you some troubleshooting time.

See you later!

2 thoughts on “Synchronization between Sitecore Commerce catalog and Dynamics AX does not work

  1. Hi Pablo,

    I came cross this blog from you on the AX/Sitecore catalog sync. Thanks for the reference to my blog:-) Just a note here for the latest issue on 404 error with missing IIS verbs, yes these settings are missing from the OOB Sitecore and Sitecore Commerce for AX packages (SCpbMD). But they are inside the merge files from the Reference store front sample site package that’s the reason I noted in my blog (upd1 version) to use the merge files there even one is not planning to deploy sample site.

    Hope it clarifies something and thanks for your interests on Sitecore products.

    Hao

    Like

    • Hi Hao!

      Great to have you here.

      I did notice that the error is not present when you merge the storefront config, but I just wanted to mention it in case someone else was losing their minds troubleshooting the issue.

      Thanks for visiting, and many many thanks for being helpful in your blogs and in the support site!

      Have a great day!

      Like

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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