Web Services Example Cartridge

Salesforce B2C Commerce provides a cartridge and demo data to demonstrate how to create web services.
Note: The web service is provided by an entity outside of B2C Commerce. 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.
  1. Download the web services cartridge 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.

    See Adding an Existing Cartridge to Your Storefront

  3. Put the cartridge in your cartridge path.

    See Registering Your Cartridge

  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.
        1. In your browser, navigate to http://www.reportingsales.com/signup.aspx.
        2. Enter an email and password.
        3. Click Sign Up. Check your email address for the application key. This usually takes under half an hour to arrive.
      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