Tutorials > Program model > Web services > Create a WebSphere Commerce service module (SOI)
| Next >
Tutorial: Creating the Get TutorialStore service
In this tutorial we will follow the development of a sample service module, TutorialStore, based on the concept of a Store in WebSphere Commerce version 7. The services provided by the tutorial store will be Get and Process. In this tutorial part, the Get service is used to retrieve store information based on a search expression.
Since this is an SOI tutorial, the pattern will create a service module that provides service-oriented integration into the existing controller commands, access beans, and EJBs.
Learning objectives
The tutorial will demonstrate how to support the following XPath expressions.
- Find store by store ID: /Store[StoreIdentifier[UniqueID='123']]
- Find store by name: /Store[StoreIdentifier[ExternalIdentifier[NameIdentifier='StoreName']]]
- Retrieve all stores: /Store
For the purpose of this tutorial, the definition of the TutorialStore contains the information listed in the table below. The table shows the access profile that includes this information for the preceding XPath expressions.
Data Description Applicable Access Profiles Store identifier information Information to uniquely identify the store. Summary, Detail, All Store description Description information about the store. Detail, All State Whether the store is "Open", "Closed" or "Suspended." Detail, All Store category The category of the store, such as B2C or B2B. Detail, All Inventory system The inventory system used by the store. Detail, All Store relationship The store directory that contains the file resources associated with the store. Detail, All Supported languages The languages supported by the store. All Support currencies The currencies supported by the store. All Fulfillment center The fulfillment center associated with the store. All
Time required
Expect this tutorial to take 2 hours to complete.
Audience
This tutorial is intended for WebSphere Commerce developers who are responsible for creating and customizing WebSphere Commerce services.
Prerequisites
Before beginning this tutorial ensure that you have fulfilled the following prerequisites:
- Installed WebSphere Commerce version 7.
- Install WebSphere Commerce Developer
- Set up the development environment for creating WebSphere Commerce services
- Installed the Java Emitter Template (JET) package using the IBM Installation Manager.
- Extracted the tutorial sample code, TutorialStore.zip, to a temporary location on the hard drive.
Prerequisite knowledge
To complete this tutorial you should be familiar with the following terms and concepts:
- WebSphere Commerce service module
- Eclipse plug-ins
- The Java programming language
- Rational Application Developer
- How to import code into Rational Application Developer
- XML and related XML technologies such as XSD
- Register commands with WebSphere Commerce
- Run SQL scripts against a relational database
Lessons in this tutorial
- Define the TutorialStore noun
In this step, the TutorialStore noun is defined. This noun represents the logical data model of the new component that you are going to create. The definition of this logical model is a key development step, as this model is exposed to any client using the TutorialStore service, for example JUnit, and WebSphere Portal.
- 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.
- Generate the SDOs for the TutorialStore noun
In this step, you generate the data objects required for implementing the logical data model of the TutorialStore noun, which is defined in the TutorialStore.xsd file.
- Implement the component facade
In this step, you implement the code logic in the component facade for handling the GetTutorialStore requests, in addition to implementing the code for generating ShowTutorialStore responses.
- Implement the client library
In this step, you add convenience methods that hide the complexity of creating the different GetTutorialStore requests.
- Deploy and validating the TutorialStore service module with JUnit
In this step, you are going to use the generated JUnit test class, TutorialStoreFacadeClientTest, to validate the TutorialStore service module.
- Create the Get TutorialStore service summary
This section summarizes the tutorial.
- Modify the TutorialStore service module projects
In this step, you reuse the Java Emitter Template (JET) to modify the base code for the Get TutorialStore component and introduce the support for Process. Your existing Get TutorialStore service logic remains unchanged.
- Regenerate the SDOs for the TutorialStore noun
In this step, you generate the data objects required for implementing the logical data model of the TutorialStore noun, which is defined in the TutorialStore.xsd file.
- Implement the component facade
In this step, you implement the code logic in the component facade for handling the ProcessTutorialStore requests, in addition to implementing the code for generating AcknowledgeTutorialStore responses.
- Implement the client library
In this step, you add convenience methods that hide the complexity of creating the different GetTutorialStore requests.
- Deploy and validating the TutorialStore service module with JUnit
In this step, you are going to use the generated JUnit test class, TutorialStoreFacadeClientTest, to validate the TutorialStore service module.
- Create the Process TutorialStore service summary
This section summarizes the tutorial.
| Next >