One of the most important skills regarding Sitecore Commerce development is to find the correct commands and pipelines to extend the behavior of the Commerce engine. In this article I will introduce some useful tools to support you.

1) Fiddler

Fiddler is a free web debugging proxy developed by Telerik. With this tool you will be able to capture the traffic between the Sitecore storefront and the Sitecore Commerce engine.

Because Sitecore XC 9.1 uses https for each connection by default, we must enable https capturing in the fiddler options:

  1. Click Tools > Fiddler Options > HTTPS.
  2. Check the Decrypt HTTPS Traffic box.
  3. Click on Skip decryption to change it to Perform decryption only for the following hosts.
  4. Add required host names, e.g. localhost, commerceauthoring.sc9.qa

The first time you activate https capturing you have to trust the FiddlerRoot Certificate. This root certificate is required because fiddler will decrypt the traffic and encrypt it with a certificate signed by this root certificate.

Because all traffic is directly on the local machine Fiddler will not be able to capture it. Therefore, we must change the web.config of the storefront to use Fiddler as proxy. You can read more about this topic on the Fiddler web site.

<configuration>
 <system.net>
  <defaultProxy>
   <proxy autoDetect="false" bypassonlocal="false" proxyaddress="http://127.0.0.1:8888" usesystemdefault="false" />
  </defaultProxy>
 </system.net>
</configuration>

Now you can capture traffic from the storefront to the Commerce Engine.

This is an example of successfully captured requests between the storefront and the Commerce Engine.
When you select one of the requests, you will see the request and response details.

If you stop Fiddler you will get error messages, because the storefront is no longer able to connect to the Commerce Engine. Therefore, you must disable the proxy configuration in the web.config when you don’t need Fiddler.

2) Plumber Configuration Viewer

Plumber Configuration Viewer for Sitecore Commerce is developed by Erwin Werkman. It is a useful tool to browse the configuration of your Commerce Engine. The configuration viewer is a separate web site. To install and configure this site, just follow the instructions of the Readme on GitHub.

With Plumber you can search for Pipelines and Blocks. In addition, you can view the Policies, Metadata and Plugins.

3) Commerce Engine Log Files

The Commerce Engine writes a log file containing the used configuration for the pipelines and blocks. You can find the log file inside the website folder -> wwwroot -> logs. The name of the log file starts with NodeConfiguration_Deployment.

On my system the location of the log file for the authoring role is:
C:\inetpub\wwwroot\CommerceAuthoring_Sc9\wwwroot\logs

This log files can by handy especially on remote systems.

4) Postman

The SDK of the Sitecore Commerce engine comes with some Postman collections. With these collections you get a good overview of the available commands. Postman is also a handy tool when it comes to debugging the commerce engine.

After you have installed Postman, you must import the collections:

  1. Click File > Import…
  2. Click Import Folder > Choose Folders
  3. Navigate to the Sitecore Commerce Engine SDK folder, select the postman folder and click on Select Folder
  4. If not already selected, click on the Collections tab.

Because the Commerce Engine is using self-signed certificates, we must disable SSL certificate verification:

  1. Click File > Settings
  2. Click General > SSL certificate verification.
    • Ensure that the value is no OFF

Maybe you have to edit the environment values. On my machine I had to update the value for SitecoreIdServerHost to the value https://playground.identityserver.

After everything is set up, you can test the API methods. Before you call any other API method you must request an authentication token.

An example of an API request and response.

You can find a more detailed instruction for setting up Postman on the Blog tothecore.sk.

Summary

I hope you find this overview helpful. If you have questions to any of these tools, please leave a comment.

You know other helpful tools? Please share it in the comments.

Leave a comment

Your email address will not be published. Required fields are marked *