Home


Overview of the WebSphere Commerce Web services framework

The WebSphere Commerce Web service framework uses the Model-View-Controller (MVC) approach to process Web service requests. As shown in Figure 1, when the Web service request enters the system, the processing steps are broken down...

1. Controller: Determine the business logic

2. Model: Execute the business logic

3. View: Render the response

Controller commands are used to perform the business logic of the operation and JSPs are used to create the Web service response. By using both types of assets, DynaCache is leveraged to cache Web service requests that contain dynamic elements which do not change the result.

Figure A-1 Web services framework

DynaCaching of Web services requests and Web requests only differ in how the business logic is determined. Web requests use the Struts configuration file to identify the controller command interface and JSP response. Web service requests use the messaging mapping component to identify the controller command interface and JSP response.

The message mapping component uses the XML document type to identify the controller command interface and JSP response. It also breaks the XML document down into a set of name-value-pairs that are used as input parameters to the controller command. Based on the XPath configuration, the XML elements of the Web service request are represented in a similar name-value-pair format to a Web request. For simple XML documents, the structure is mapped exactly like a Web request. The mapping facility uses an additional list structure to represent more complex XML documents. The resulting data structure is similar to the one created for Web requests and DynaCaching of Web services is able to reuse the same controller and task commands as a Web request.

The WebSphere Commerce Web services framework uses the SOAP element binding to route the request to the Web Service controller. It passes the XML body of the SOAP request to the controller. The controller uses the message mapping feature to work out which controller command to use to service the request. It then parses the XML body into name-value pairs and passes them to the controller command.

Message mapping is also used to construct the success or error response. The name-value-pairs returned by the business logic are merged with the initial name-value-pairs and passed as request parameters and attributes to the JSP responsible for rendering the response.

If you specify that a request only returns data in the message mapping configuration then the controller command calls the JSP directly to build the response. In this case, the name-value-pairs returned from the message mapping will be the request parameters and attributes to the JSP.

The Web service response is built with JSPs and leverages existing JSP technology and assets. The JSP uses the Web service definition to generate the document structure and XML element tags of the SOAP response. The user task is to write the JSP code to populate the XML elements. Although the purpose of the JSP is to return XML instead of HTML, the same JSP concepts apply, including JSTL, JSP fragments, and caching.

+

Search Tips   |   Advanced Search