Configuring Web Services in Business Manager

This topic describes how to configure a web service in Business Manager. See Web Servicesfor an overview of web services. You can customize web service profiles, credentials, and configurations by using custom properties. See Creating Custom Attributes for Web Services

Creating a Web Service Profile

The web service profile defines how Salesforce B2C Commerce detects and manages high numbers of requests to and responses from the service, as well as its availability. Different services with similar requirements can all use the same service profile.

  1. Select Administration > Operations > Services.
  2. On the Services page, click the Profiles tab.
  3. On the Service Profiles page, click New.
  4. On the New Service Profile page, enter a descriptive name for the profile.
  5. Enter the number of milliseconds for the client connection timeout. B2C Commerce waits this number of milliseconds for a response from the web service before throwing an error.
    Note: For HTTP services, Salesforce recommends a timeout of 2-10 seconds for storefront and B2C Commerce tool requests.
  6. Check the Enable Circuit Breaker box if you want to enable the circuit breaker to identify when a service is unavailable and stop making calls to the web service. See also Web Service Rate Limiter and Circuit Breaker.
    Note: Salesforce recommends that you always enable the circuit breaker and configure it according to the service call rate.
  7. Enter the number of calls that must fail to trigger the circuit breaker into the Max Circuit Breaker Calls field.
  8. Enter the number of milliseconds in which the maximum number of calls can fail into the Circuit Breaker Interval (ms) field.
  9. Check the Enable Rate Limit box if you want to limit the number of outgoing calls within a specific interval.
  10. Enter the maximum number of calls that B2C Commerce makes for the rate limit interval into the Max Rate Limit Calls field.
  11. Enter the number of milliseconds in which B2C Commerce can make the maximum number of calls to the web service into the Rate Limit Interval (ms) field.

Creating a Web Service Credential

The web service credentials are used for basic authentication. For two-factor authentication, see Importing Certificates for an Instance.

  1. Select Administration > Operations > Services.
  2. On the Services page, click the Credentials tab.
  3. On the Service Credentials page, click New.
  4. On the New Service Credential page, enter a name for the profile. This name can't contain spaces. Use a descriptive name, but do not include user or password information. For example: http.mysite.myservice.cred.
  5. Enter the URL to the service, including the protocol. For example: ftp://51.134.145.10
    Note: To use one service configuration for several URIs, you can extend or alter this URL using the getURL callback in the service registry definition.
  6. Enter the username for the credential.
  7. Enter the password. The password is masked after you type it and can't be retrieved from the Business Manager, so be sure to store the value securely elsewhere.

Creating a Web Service Configuration

The web service configuration specifies the credentials and web service profile that B2C Commerce uses when calling a web service.

  1. Select Administration > Operations > Services.
  2. On the Services page, click New.
  3. On the New Service page, enter a name for the service. Service definitions use this name. If service names contain periods, then they become part of the logging hierarchy. Salesforce recommends naming services with cartridge.protocol.service.operation. For example: mycartridge.http.payment.get or mycartridge.ftp.partner.getPriceList. Including the cartridge in the name is useful when you have multiple web service integrations, because it groups logging information and ensures unique service names.
  4. Select the wrapper type to use for your web service. The type determines the underlying class used to call your web service and adds methods to the methods inherited from the Service class. See also Service Types.
  5. Check the Enabled box if the web service is available and you want to make calls to it. It isn't enabled by default.
  6. In the Service Mode list, select:
    • Live: To make calls to a live web service.
    • Mocked: To use the mocked call configured in your service registry to simulate the expected response from the web service.
  7. Enter the name of a prefix for the log file for this service. If no prefix is entered, the log name defaults to main. All logs are written in the shared log directory to a file named service-prefix-internalID-date.log. If you do not enter a prefix, the file is named service-main-serviceID-date. See also Web Service Logging and Troubleshooting
  8. Check the Communication Log Enabled box if you want data in the request and response of the web service call to be logged.
    Note: If you enable the communications log, Salesforce strongly recommends using the log filtering callback methods to remove private or sensitive data from the log messages.
  9. Check the Force PRD behavior in non-PRD environments box if you want to prevent communication logs from being written on non-production instances.

    If you enable this setting on a non-production instance, communication logs are disallowed unless a filter is configured. If you disable this setting on a non-production instance, communication logs are allowed regardless of whether a filter is configured. This setting has no effect on production instances.

  10. Select one of the service profiles.
  11. Select one of the service credentials.

Timeout

Specify the timeout in milliseconds. This value is used for both the connection and socket timeout of any internal connection. If B2C Commerce receives no response within this time, it throws an error.

The total run time of a service can be longer than the timeout, as long as individual responses don't exceed it. For example, consider a 5000-ms timeout. A 4-second connection attempt, followed by reading two chunks of data at 4 seconds apiece, takes about 13 seconds total. Because none of the individual communications exceeded 5 seconds, the process does not time out.

Next Step: Creating a Service Registry