Develop > Persistence layer > Work with WebSphere Commerce services > Create the component facade


Create the service command

The service command is the entry point on the component facade where the Business Object Document (BOD) begins to be processed by the business logic.

To create a service command:


Procedure

  1. Create a WebSphere Commerce service module. This generates the shell of a command class for you.

  2. Go to the MyServiceModule-Server project.

  3. Open the com. mycompany.commerce. myservicemodule.server.commands. VerbNounCmdImpl.java class.

  4. Complete this shell command by implementing the business logic by following either the design pattern for Get service implementation or the design pattern for Process, Change and Sync service implementation. This is the simplest approach to implementing a component facade -- use the shell command to execute any existing WebSphere Commerce or custom commands containing business logic you wish to reuse.

  5. (Optional) Alternatively, you can use the Message mapper to flatten the XML messages into name-value pairs appropriate to the WebSphere Commerce commands. If you do so, we will use the command registry table to select the correct command implementation, based on the inbound XPath expression in the BOD. For an example of how the member subsystem maps XML messages to command name-value pairs, see the Member component message mapper.

  6. Register your new command. When you do so, if you are using the message mapper, associate the XPath search expression key with the new custom fetch command implementation with an SQL statement. For example:

    insert into cmdreg (STOREENT_ID, INTERFACENAME, CLASSNAME,TARGET)
    VALUES 
    (0,'com.ibm.commerce.catalog.facade.server.commands.FetchCatalogEntryCmd+/CatalogEntry[Price[StandardPrice[Price[(Price<=
    and Price[@currency=]) 
    and (Price>= and Price[@currency=])]]]]', 'com.mycompany.commerce.customization.catalog.FetchCatalogEntryByPriceRangeTaskCmdImpl', 'Local');
    

    Notes:

    1. The interface name contains the name of the command concatenated with the XPath.

    2. For implementations that do not use the Message mapper, including WebSphere Commerce member subsystem customization, update the CMDREG entry for the existing default fetch command. Also, no XPath details are included in the SQL update.


Related concepts

WebSphere Commerce service commands

WebSphere Commerce Web services

WebSphere Commerce service module

Component facade interfaces

Design patterns


Related tasks

Create the component facade

Create a new search expression

Extend a noun


+

Search Tips   |   Advanced Search