Web Services Example Cartridge

Salesforce B2C Commerce provides a cartridge and demo data to demonstrate how to create web services.

Note: The web services are provided by entities external B2C Commerce, and some of them are no longer available. However, even if the web service is down or not functioning, the code example has still been tested and represents best practices for web service coding.
The cartridge also exercises the mock call functionality provided by the framework. The example uses these endpoints:
  • HTTPbin - Endpoint for HTTP calls. Located at:
  • WeatherWS - Document based SOAP 1.1 endpoint. The WSDL is located here:
  • Census - Document based SOAP 1.2 endpoint.
    Note: This endpoint is no longer valid, because the external site hosting this web service (http://www.reportingsales.com) is no longer active.
  1. Download the web services cartridge at Code Example.

    Your download files include the service_framework_test cartridge and a service_framework_demo_data folder with service definitions, profiles, and credentials.

  2. Add the cartridge to your server.

  3. Put the cartridge in your cartridge path.

  4. Upload the service_framework_demo_data files to your instance.
    1. Zip up the folder and give it the same name as the folder it contains.
      Note: If you are using a Mac, zip up the folder on the command line and don't use the Compress Folder functionality in the right-click menu. Compressed folders are treated as an invalid format by B2C Commerce.
    2. Select Administration > Site Development > Site Import & Export.
    3. In the Import section, browse to your .zip file, select it and click Upload.
    4. When the file is uploaded, select it and click Import.
  5. Configure basic authentication on your instance. Although you have imported credential objects with the correct names from the service_framework_demo_data, you must manually enter the username and password for each service. This is to make sure that credential information can't be exported in an unencrypted form.
    1. Select Administration > Operations > Services
    2. Click the Credentials tab. Most of your imported credentials don't need passwords. However, you need to manually add password information to the following profiles:
      • test.http.cred - for the password, enter
      • test.soap11.cred - you need to get an application key from the external site and paste it into the credential password property.
        Note: This credential is no longer valid, because the external site hosting this web service (http://www.reportingsales.com) is no longer active, and you cannot obtain an application key.
      Note: By default, all imported credentials appear to have a masked password, for security reasons. However, no passwords exist until you enter them manually.
  6. Trigger the web service call. Assuming your base URL looks similar to https://www.mystore.com/on/demandware.store/Sites-Site use the following links to call the web service.

    HTTP service
    HTTPForm Service
    FTP Service
    SOAP 1.1 service
    Soap 1.2 service

X Privacy Update: We use cookies to make interactions with our websites and services easy and meaningful, to better understand how they are used. By continuing to use this site you are giving us your consent to do this. Privacy Policy.