Tutorials > Program model > Web services
Tutorial: Customizing Web services and WebSphere Portal to support a new search
Attention: This tutorial is currently under revision. The content might contain errors or inaccuracies. Subscribe to this page to be notified when an updated version is available.
Customize Web services and WebSphere Portal to support a new search expression.
Learning objectives
There are many options available when customizing the service-oriented architecture provided by the Catalog subsystem. One such customization is to allow searching based on data fields that were not included in any existing commands.
In this scenario, a new search expression is created to allow the user to search for all types of catalog entries in a catalog based on the minimum and maximum offer price.
In order to accomplish this goal, it is necessary to create a new Fetch command which will set the required minimum and maximum offer price into a data bean. The results from that data bean can then be passed to an existing Compose command for composition into a response BOD as defined by the Catalog subsystem's logical model. That response BOD is sent to the portal server to display.
This implies that the only new code artifact which must be generated is the fetch command as mentioned. This tutorial will show you how such a fetch command is created, and in turn how the results produced by that fetch command can be consumed by an existing compose command. Then, instructions will be given to show how the new fetch command can be packaged into either a toolkit environment, or a WebSphere Commerce production server environment.
Time required
Expect this tutorial to take about 2 hours to complete if the prerequisite steps have been completed.
Audience
This tutorial is intended for advanced developers who are responsible for creating new business logic.
Prerequisites
IBM recommends, but not required, that you complete the Tutorial: Creating a WebSphere Commerce Service Module tutorial before you start this tutorial, in order to understand the integration points between the WebSphere Commerce Server and the WebSphere Portal Server. This tutorial demonstrates how to modify a pre-configured WebSphere Commerce standard portlet in the WebSphere Portal server to communicate with the created TutorialStore service.
Before beginning this tutorial, do these tasks:
- Install WebSphere Commerce Developer.
- Setup the WebSphere Commerce Portal development environment.
- Create a WebSphere Commerce sample portal page on WebSphere Portal.
- Set up the TutorialStore service on WebSphere Commerce, following the steps in Tutorial: Creating a WebSphere Commerce service module.
To skip the tutorial, follow the instructions in Deploying the component facade starting at step 3. The files mentioned in the task are provided in the following ZIP file: tutorialstore_process_projectinterchange.zip.
- Download and unzip the sample tutorial code, PortalTutorial.zip, to a temporary location on the hard drive.
- Copy WCDE_INSTALL/portal/MVCPortlet from the WebSphere Commerce Developer environment to the same temporary location on the hard drive.
- Copy the contents from the TutorialStoreServer/sampleConfig/xml/config directory to the WC_EAR/xml/config directory.
- Run the following SQL statements to prepare the WebSphere Commerce Developer database:
- Run the SQL statements from Step 5 of Implement the component façade of the Creating the Get TutorialStore service tutorial.
- Run the SQL statements from Step 7 of Implement the component façade of the Creating the Process TutorialStore service tutorial.
- Configure the message mapper for the Process action:
- Complete Step 8 of Implement the component façade of the Creating the Process TutorialStore service tutorial.
- Verify the TutorialStore service is functioning properly.
Knowledge prerequisites
To complete this tutorial you should be familiar with the following terms and concepts:
- Understand of the Java programming language.
- Basic understanding of the database type used in the WebSphere Commerce development environment.
- Basic understanding of JSP pages.
- Basic understanding of EJB beans.
- Basic understanding of access beans and data beans.
- Eclipse plug-ins.
- Rational Application Developer.
To perform the customization, extensions are required to both the WebSphere Commerce Server and the WebSphere Portal Server.
Lessons in this tutorial
- Create the project structure in the WebSphere Commerce development environment
In this step we will create the project structure to be used in WebSphere Commerce Developer.
- Changing the code to allow additional search parameters
Adding new search parameters to the fetch command.
- Register the new command
This section explains how to register the new command.
- Test the new fetch command
There are many ways to consume the new fetch command. In this step it is tested as part of a JUnit test in the Rational Application Developer environment.
- Create a JSP Snippet to display the price search fields
This section refers to creating a JSP Snippet to display the price search fields.
- Changing SearchDisplay.jsp to use the new search expression
This section refers to changing SearchDisplay.jsp to use the new search expression.
- Add an expression-builder for the new search expression
This section refers to adding an expression-builder for the new search expression.
- Test the new search expression
This section refers to the testing of the new search expression.
- Customize Web services and WebSphere Portal to support a new search expression
This section summarizes the tutorial.