Tutorials > Program model > Web services > Create a WebSphere Commerce service module (SOI) > Creating the Get TutorialStore service
Generate the TutorialStore service module projects
In this step, you are going to use the Java Emitter Template (JET) to generate the base code for the TutorialStore component. A significant amount of Java code is related to the processing of WebSphere Commerce nouns and can be abstracted and generated. This allows you to focus on implementing the code specific to each component, for example the component's nouns and the noun's business logic.
Procedure
- Start WebSphere Commerce Developer.
- Open the J2EE perspective.
- Create the application definition file to create the base code for the TutorialStore SOI service module.
- Create the service module input file.
- Right-click on the WebSphereCommerceServerExtensionsLogic project and select New > Folder.
- Enter ServiceModuleDefinition as the folder name. This creates a single location to store all service module input files.
- Right-click the ServiceModuleDefinition folder and select New > File.
- Enter SOITutorialStore.xml as the filename and click Finish.
- Paste the following application definition into the file:
<_pattern:commerceComponent xmlns:_pattern="http://www.ibm.com/xmlns/prod/commerce/foundation/pattern" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.ibm.com/xmlns/prod/commerce/foundation/pattern ../../WC/xml/config/xsd/wc-component-patten.xsd " name="SOITutorialStore" packagenameprefix="com.mycompany.commerce" company="MyCompany" namespace="http://www.mycompany.com/xmlns/prod/commerce/9/soitutorialstore" nlsprefix="myco" type="SOI"> <_pattern:noun name="TutorialStore" get="true" process="false" change="false" sync="false"/> </_pattern:commerceComponent>
The definition indicates the name of the noun (TutorialStore) and the verbs that are enabled for the pattern. This file determines the assets and code to be generated for you.
- Save the file.
- Right-click SOITutorialStore.xml and select Run As > Input for JET Transformation:
- In the Transformation section:
- Select the following ID:
- com.ibm.commerce.toolkit.internal.pattern.componentprojects
- Click OK.
- The pattern is applied. Verify that the following projects are created, by switching to the Navigator view:
- SOITutorialStore-Client
- SOITutorialStore-DataObjects
- SOITutorialStore-Server
- SOITutorialStore-UnitTests
- SOITutorialStoreServicesHTTPInterface
- SOITutorialStoreServicesJMSInterface
- Update the build dependencies for the service module:
This is necessary as build dependencies are managed using the Java EE Module dependencies instead of the project classpath. This requires projects to be added to a J2EE application.
- Add the service module to the WebSphere Commerce application.
- Switch to the J2EE perspective and expand the WC project.
- Double-click WebSphereCommerceServer.
- Select the Design tab.
- Click Add....
- Select Module and click OK.
- Select SOITutorialStore-Server and click Finish.
- Click Add....
- Select Module and click OK.
- Select SOITutorialStoreServicesHTTPInterface and click Finish.
- In the Application Deployment Descriptor Editor, click Manage Utility Jars under Actions.
- Ensure the following values are selected
- SOITutorialStore-Client
- SOITutorialStore-DataObjects
- Click OK.
- Save the deployment descriptor (Ctrl + S).
- Right-click the SOITutorialStore-Server project and select Properties.
- Select Java EE Module Dependencies.
- Ensure the following are selected:
- Enablement-RelationshipManagementData.jar from the WC project.
- Enablement-RelationshipManagementLogic.jar from the WC project.
- SOITutorialStore-Client from the SOITutorialStore-Client project.
- SOITutorialStore-DataObjects from the SOITutorialStore-DataObjects project.
- Click OK.
Build errors will show up in the projects at this stage because the TutorialStore data objects have not yet been generated from the TutorialStore noun. You can ignore these build errors for now and continue with the tutorial. Once the data objects are generated in the next steps of the tutorial, these compilation errors will be resolved.