Web Services

Salesforce B2C Commerce provides a web service framework that allows you to manage calls to unavailable web services, cap the number of calls to a web service, and analyze web service performance.

B2C Commerce provides a web service example and instructions for implementing the example. See also Web Services Example Cartridge

Note: If you are implementing a new link partner cartridge, some of the configuration and scripting for integration might already exist in the link partner cartridge. Refer to the link partner documentation to determine which of the following steps apply to your implementation.

Web Service Overview

In Business Manager, each web service is configured with a service configuration, which specifies a service profile and service credential. The service configuration generates a ServiceConfig object. The service credential is used for basic authentication. The service profile determines how B2C Commerce manages timeouts and rate limits for the web service.

The Service Registry Script

The package.json uses the init keyword to set the service registry scripts for your cartridge. When the service registry script is run, all ServiceDefinition objects configured in the service registry are initialized.

B2C Commerce runs the service registry script the first time that a web service script is called for your cartridge and any time your service registry script is changed.

The Web Service Script

At run time, your web service script uses ServiceRegistry.get to get a new a Service object based on a registered ServiceDefinition object. invokes it. The web service script might choose to alter or extend the Service object. Then the web service script uses Service.call to invoke the service.

The platofrm checks the circuit breaker/rate limit to determine whether to call the web service. if neither is triggered, then the callbacks in the ServiceDefinition are executed and the result of the call is stored in the Service object.

The web service script outputs the result of the service invokation to the pipeline dictionary or throws a PIPELINE_ERROR.

See also SOAP Web Services.

Creating a New Web Service

To create a new web service:

Getting the Web Service Ready to Go Live

  1. Configure credentials, private keys and certificates on the Development and Production instance. These can't be imported or exported and must be manually created on each instance.
  2. Use code replication to push your code to the Development and Production instance.
  3. Select Administration > Site Development > Site Import & Export select the Service option to export your service, profile, and credential configurations and import them into the Development and Production instances.

Web Service Performance and Incident Analysis

If you experience reports of problems with a specific web service on your site, in addition to logging, you can also investigate the incident using the analytics for registered web services.

The analytics are available at Business Manager: Administration > Operations > Service Status.

Click on any web service name to drill down to see information about the performance of that web service. Data for a web service is available in near real-time. Data is stored for up to 10 days.