Creating a WebSphere Commerce service module
The WebSphere Commerce service module contains all the assets that are used
by a WebSphere Commerce service. If you are planning on providing new WebSphere Commerce
services, you must create a new service module, then further customize and extend the assets that it
creates.
Before you begin
About this task
The Java Emitter Template (JET) is used to generate the base code for the new service module from a simple XML file. By describing the service module in a specialized XML syntax, the service modules can be generates. You can start with the service module implementation without having to spends hours with the setup and configuration of a service module.
What to do before you create a new service:
- Determine whether a new service is needed or an existing service can be extended. When custom
information is required, there are three options:
- Include custom information in the UserData area of an existing noun
- Include custom information as an overlay of an existing noun
- Create a custom service
- Determine the service name. A service consists of a collection of related nouns and the operations that can be performed on those nouns. For example, the Catalog service consists of the Catalog, CatalogGroup, and CatalogEntry nouns and supports retrieving, creating, updating, and deleting these nouns.
- Determine the service nouns. For more information, see Nouns.
- Determine the operations (verbs) for each noun. For more information, see Verbs.
- Determine the service implementation (SOI versus BOD). For more about the differences between the two implementations, see SOI and BOD service modules.
Procedure
To create a new WebSphere Commerce service module:
- Start WebSphere Commerce Developer.
-
Create the pattern application definition file to create the base code:
- Right-click MyServiceModule.xml and select .
-
In the Transformation section:
- Select the following ID:
com.ibm.commerce.toolkit.internal.pattern.componentprojects
- Click OK.
- Select the following ID:
-
After the pattern is applied, verify that the following projects are created:
- MyServiceModule-Client
- Contains the client library Java code.
- MyServiceModule-DataObjects
- Contains the XSD, WSDL, and generated SDOs.
- MyServiceModule-Server
- Contains the component facade implementation.
- MyServiceModule-UnitTests
- A module for unit test the client implementation.
- MyServiceModuleServicesHTTPInterface
- The web module that is used to enable the service module for web services over HTTP.
- MyServiceModuleServicesJMSInterface
- The EJB module that is used to enable the service module for web services over JMS.
Note:- You can ignore the compilation error messages. Java objects that represent the noun do not yet exist, and are generated in the next step. In addition, the newly generated projects are not yet added to the WebSphere Commerce Application and cannot resolve dependencies on WebSphere Commerce code.
- Informational messages in the following form can be
ignored:
That is, SOAPElement objects can be serialized.CHKJ2500I: change<<Noun>>(javax.xml.soap.SOAPElement) in method javax.xml.soap.SOAPElement must be serializable at runtime (EJB 2.0: 7.10.5).
- Each generated project also contains a prefix, either SOI or
BOD, depending on the selected type of your implementation. For example,
MyServiceModule-Client
would be eitherSOIMyServiceModule-Client
orBODMyServiceModule-Client
.- If you specify SOI, the pattern creates a service module that provides service-oriented integration into your existing controller commands, access beans, and EJBs.
- If you specify BOD, the pattern creates a service-oriented architecture service module that use commands developed by using the BOD command framework. These BOD commands act upon Structured Data Objects (SDOs) and use the Business Object Mediator to persist and retrieve these SDOs.
- Add the generated modules to the WebSphere Commerce Application.
-
Next steps: