Web enablement for the client library

As a guideline of how to enable the client library for the Web, each action should be represented as a separate method. Ideally the Web client library has a corresponding method for each Web URL request for that component. For example in the case of a shopping cart, there are URL requests to add an item, update an item and remove an item. These three actions should be represented as different methods on the client library.

The map input method should call out to a protected build method to convert the Map input into the structured object. The map contains an array of strings and the key is the parameter name. A developer can generically update the set of name-value pairs that makes up a particular complex type of the request and not have to modify multiple methods. The map-based method must delegate to these methods to build up the complex type and piece together the complex objects to build the service request. This allows for only one code touch point when the customization wants to support additional name-value pairs instead of having to extend multiple methods. If a programming-friendly method exists that builds up the same message, the method delegates to that method.

The Struts presentation framework uses reflection to delegate the URL request parameters to the appropriate client library Web method. Struts has as part of its configuration a mapping between the URL request and the client library class and method to implement. The Struts framework also has a lookup service Struts plug-in that returns the right implementation for a specified client library. Since the mapping of client library class to URL can be rather lengthy, and more URLs can be added during upgrades, there is a single point of configuration that helps to globally control the class implementation. This way we can use the customized client library for all references of a particular client library without have to change every URL reference to that library. This client implementation lookup service provides that single point of custom configuration.

The client libraries for the provided components: member, order, and catalog are already enabled for the Web.


Related concepts
Client library for WebSphere Commerce services
Client library enablement for Struts


Related tasks
Creating the client library
Deploying the client library
Extending the client library


Related reference
WebSphere Commerce foundation tag library