Tutorial: Defining a User Registration Web Service
The purpose of this tutorial is to demonstrate how to create an OAGIS style Web services that will create a new customer in WebSphere Commerce through Web services using the WebSphere Commerce Web services framework. This tutorial will demonstrate the steps involved in defining a new service that uses the OAGIS style to create a new customer, register the service in WebSphere Commerce and create the response JSP template to generate a confirmation response.
Extended description of tutorial.
Learning objectives
In this tutorial, a SyncCustomer service will be created. This service will follow the XML schema conventions set by OAGIS (http://www.openapplications.org) but will not exploit the OAGIS schema elements for simplicity. This service will define an XML schema that will represent an existing business logic operation of registering a new user (UserRegistrationAdd). Using the Web services framework, the service will delegate to the existing business logic to create a new user and use a JSP template to return the internal identifier of the user along with the user's distinguished name. At the end of this tutorial, there will be a Web service that can be used by external applications to create users in WebSphere Commerce. This tutorial highlights the following features of the Web services framework:
- Define an OAGIS style Web service
- how to call existing business logic
- create a success confirmation message
- create a custom failure message
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
Configure WebSphere Commerce Developer for Web service development Before beginning this tutorial, ensure that you have configured WebSphere Commerce Developer for Web service development. Knowledge prerequisites Before beginning this tutorial ensure that you have:
- Knowledge of the XML schema editor
- Knowledge of the WSDL editor
IBM recommends that you also follow the tutorial to define a Web service to retrieve product information. Resources Download the zip file containing all the code relating to this tutorial.
Lessons in this tutorial
- Define the SyncCustomer schema
This section describes the steps involved in creating a new XML schema definition. The XML schema will define a Web service to create customers. Since this tutorial follows the OAGIS structure, the directories in which the XML schema is placed will follow the OAGIS overlay recommendation. After completing this section, you will have an XML schema that is used to define the Web services.- Define the WSDL
This section describes how to expose the SyncCustomer schema as a Web service. The Web service defined in this tutorial is a customer service which is represented by the SyncCustomer message. Furthermore, this Web service will respond with an OAGIS ConfirmBOD that contains an acknowledgement that a customer was created.- Mapping a WSDL document to the WebSphere Commerce Web Services Framework
This section is related to mapping a WSDL document to the WebSphere Commerce Web Services Framework.- Configure message mapping for a Web service request
This section describes how to enable 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 ConfirmBOD responses JSP page
When executing the business logic, there are two types of responses that can be returned. Both responses comply with the OAGIS ConfirmBOD schema definition but only one response is used to show a successful execution of the service operation while the other represents a failure of the service operation. In the case of a successful operation, the confirmation response would return the internal WebSphere Commerce identifier of the customer and, in the case of a failure operation, the confirmation should indicate the error for why the request failed. In this section, the process of defining both JSP templates will be described.- Registering a Web service response JSP page with WebSphere Commerce
This section is related to registering a Web service response JSP page with WebSphere Commerce.- Testing Web SyncCustomer service
This section is related to testing Web SyncCustomer service.- Define a User Registration Web service summary
This section summarizes the tutorial.