Tutorial: Define an inbound Web service
Overview
This tutorial demonstrates how to create a Web service to retrieve information.
Learning objectives
Although WebSphere Commerce promotes using an OAGIS style schema to define services for simplicity this example uses simple XML schema to create a product service to retrieve product information. The WebSphere Commerce Web services framework will operate regardless of how the services are defined.In this tutorial you will use WebSphere Commerce Developer to develop a Web service that uses the WebSphere Commerce Web services framework. You will learn how to perform the following tasks:
- Develop a Web Service definition
- Set up the WebSphere Commerce Web services framework to handle the request
- Create a JSP page to generate the Web service response
- Set up a caching policy to cache fragments of the Web service response
Time required
Expect this tutorial to take about 3 hours to complete.
Audience
This tutorial is intended for WebSphere Commerce developers who will be responsible for developing Web services.
Prerequisites
Before beginning this tutorial, ensure that you have configured WebSphere Commerce Developer for Web service development.
Before beginning this tutorial ensure that you have:
- Knowledge of the XML schema editor
- Knowledge of the WSDL editor
Refer to the following technotes if you have problems with the validation of the XML Schema Definition (XSD) when using WebSphere Commerce Developer.
- http://www-1.ibm.com/support/docview.wss?uid=swg21228887
- http://www-1.ibm.com/support/docview.wss?uid=swg21221949
Lessons in this tutorial
- Prepare your workspace
This section is related to preparing your workspace.- Create the XML schema for a Web service
In this section you create the XML schema for a Web service.- Create the WSDL document for a Web service
This section contains the recommended steps for creating a WSDL document to expose your XML schema as a Web service. For more information on how to use the Web service tools, refer to the WebSphere Commerce Developer documentation.- Mapping the WSDL document to the WebSphere Commerce Web services framework
Enabling the WebSphere Commerce Web services framework to handle the WSDL document involves two parts. The first part, described in this section, is to configure the WebSphere runtime environment to map the Web service request to the WebSphere Commerce Web services framework. The second part, described in Step 6, is to configure message mapping to process a Web service request.- Configure message mapping for the Web service request
This section describes the second part of enabling the WebSphere Commerce Web services framework to handle the WSDL document. Now that you have mapped the WSDL document to the WebSphere Commerce Web services framework, you are ready to configure message mapping to process a Web service request.- Create a Web service response JSP page
The WebSphere Commerce Web services framework uses JSP pages to create the responses to the Web service requests. The JSP pages generate the response document that matches the Web service definition. In creating response JSP pages, two activities are involved. One activity (described in this section) is creating the JSP template to generate the Web service response. The other activity (described in the next section) is registering the JSP page in the Struts configuration so that it can be picked up by the WebSphere Commerce Web services framework.- Registering a Web service response JSP page with WebSphere Commerce
This section describes the second activity in creating response JSP pages. Now that you have created JSP template to generate the Web service response, you are ready to register the JSP page in the Struts configuration so that it can be used by the WebSphere Commerce Web services framework.- Add caching support for a Web service response JSP page
This section is related to adding caching support for a Web service response JSP page.- Testing the Web service
This particular sample uses a simple XML schema to define the Web service, so Web Services Explorer provides the easiest way to test the service.- Define an inbound Web service summary
This section summarizes the tutorial.