Enabling WebSphere Commerce as a service provider

You can enable a business operation defined by WebSphere Commerce as a Web service. In this scenario, WebSphere Commerce acts as the service provider to external systems.

About this task

To make a WebSphere Commerce business operation available as a Web service:

Procedure

  1. Identify the business logic that you want to expose as a Web service.
  2. Identify the controller command that represents this business logic. If it is not available, then create a new controller command. You can write new commands to call a collection of existing commands.
  3. Identify the mandatory and optional parameters that this command requires.
  4. Create a WSDL description for the Web service. WebSphere Commerce provides WSDL files to describe its Web services.
    The WebSphere Commerce WSDL files are located in the following directories:
    • WC_eardir/WebServicesRouter.war/component-services/wsdl
    • WebSphere Commerce DeveloperWCDE_installdir/workspace/WebServicesRouter/WebContent/component-services/wsdl
    If you are creating a Web client based on the WSDL files, you can copy the WSDL files into your development environment. Any WSDL files located in other directories can be ignored.

    Or, to create one from scratch, follow this lesson: Defining the Web Service Description Language (WSDL).

  5. Register the WSDL description.

    Enabling WebSphere Commerce to handle the web service: To map the WSDL document to the Web services framework you must enable WebSphere Commerce to handle the Web service. Enabling the WebSphere Commerce Web Service framework to handle the WSDL defined previously involves two steps. The first step is configuring the WebSphere Commerce Web Services runtime to delegate the Web Service request to the WebSphere Commerce Web Services framework. The second step is configuring the WebSphere Commerce Web Services to process the request. This configuration is done by using the message mapping facility to convert the XML request to a name-value-pair. The name-value-pair passes to the business logic and JSP to handle the response and configure the JSP that generates the web service response.

    Mapping the WSDL to the WebSphere Commerce web services framework: The approach taken in WebSphere Commerce is to map the WSDL to the WebSphere Commerce Web Services framework. The Web Services tooling can be used to create and update existing deployment files to generate this mapping. By using the wizard to generate a Java Bean Skeleton, you generate the required files to create the mapping and update the web services deployment descriptors to register the new WSDL.

    For more information, follow this lesson: Mapping a WSDL document to the web services framework.

  6. Write a JSP page to compose a response.
  7. Deploy the service. This includes the deployment of related files and resources. In case of a new command, you must deploy and register it in the WebSphere Commerce command registry.