Tutorials > Program model > Web services > Create a WebSphere Commerce service module (SOI) > Creating the Get TutorialStore service

< Previous | Next >


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

  1. Start WebSphere Commerce Developer.

  2. Open the J2EE perspective.

  3. Create the application definition file to create the base code for the TutorialStore SOI service module.

    1. Create the service module input file.

      1. Right-click on the WebSphereCommerceServerExtensionsLogic project and select New > Folder.

      2. Enter ServiceModuleDefinition as the folder name. This creates a single location to store all service module input files.

      3. Right-click the ServiceModuleDefinition folder and select New > File.

      4. Enter SOITutorialStore.xml as the filename and click Finish.

    2. 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.

    3. Save the file.

  4. Right-click SOITutorialStore.xml and select Run As > Input for JET Transformation:

  5. In the Transformation section:

    1. Select the following ID:

      • com.ibm.commerce.toolkit.internal.pattern.componentprojects

    2. Click OK.

  6. 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

  7. 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.

    1. Add the service module to the WebSphere Commerce application.

      1. Switch to the J2EE perspective and expand the WC project.

      2. Double-click WebSphereCommerceServer.

      3. Select the Design tab.

      4. Click Add....

      5. Select Module and click OK.

      6. Select SOITutorialStore-Server and click Finish.

      7. Click Add....

      8. Select Module and click OK.

      9. Select SOITutorialStoreServicesHTTPInterface and click Finish.

      10. In the Application Deployment Descriptor Editor, click Manage Utility Jars under Actions.

      11. Ensure the following values are selected

        • SOITutorialStore-Client

        • SOITutorialStore-DataObjects

      12. Click OK.

      13. Save the deployment descriptor (Ctrl + S).

    2. Right-click the SOITutorialStore-Server project and select Properties.

    3. Select Java EE Module Dependencies.

    4. 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.

    5. 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.

< Previous | Next >


+

Search Tips   |   Advanced Search