Enable WebSphere Commerce as a service provider

We 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.


Task info

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


Procedure

  1. Identify the business logic 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. We 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:

    • workspace_dir/WebServicesRouter/WebContent/component-services/wsdl

    If we are creating a Web client based on the WSDL files, we can copy the WSDL files into the development environment. Any WSDL files located in other directories can be ignored.

    Or, to create one from scratch, follow this lesson: ../../tutorials/tutorial/twvinboundws_2c.htm.

  5. Register the WSDL description.

    Enable WebSphere Commerce to handle the web service: To map the WSDL document to the Web services framework we 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 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: ../../tutorials/tutorial/twvinboundws_2d.htm.

  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, we must deploy and register it in the WebSphere Commerce command registry.


Related concepts
WebSphere Commerce Web services with JSP pages
Security and the WebSphere Commerce web service framework
WebSphere Commerce as a service provider
Understanding the WebSphere Commerce Web service framework
Command design pattern


Related reference
Inbound web services provided
Inventory update
Order preprocessing