Tutorials > Program model > Web services
|
Tutorial: Creating an outbound Web service client for WebSphere Commerce
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.
In this tutorial, you create MyCompanyMember outbound Web service client. This client integrates WebSphere Commerce with a sample Web service which manages users. The MyCompanyMember Web service client integrates with the UserRegistrationAdd and UserRegistrationUpdate commands to push new and updated user registration information to the sample system.The sample Web service called by the client consists of a PushUser message that contains user registration information and a PushUserConfirmation response that contains confirmation of the request.
Service Data Objects (SDO) are used by the MyCompanyMember client to build the PushUser request message and handle the PushUserConfirmation response generated from the sample system.
The tutorial results will be tested by registering a new user in the ConsumerDirect sample store and viewing the PushUser request and PushUserConfirmation response message sent between WebSphere Commerce and the sample user Web service.
Attention: When you use RAD to generate the Java artifacts, by default EMF 2.4 is chosen.
To work with WebSphere Commerce v7, explicitly select EMF 2.2 while you generate the Java artifacts. Refer to Set an EMF genmodel to generate 2.2 compatible objects for more information.
The following implications must be considered when following this tutorial:
- This tutorial uses the WC HTTP-WS Adapter, while Web service clients can be developed using the WebSphere Commerce Adapters or through a JAX-WS/JAX-RPC client.
- Transport Layer Security is the only level of security that can be enabled for this tutorial's resulting Web services. See Enable SSL for outbound Web services for more information.
- If you require additional security measures, you should consider alternatives such as creating JAX-WS/JAX-RPC Web service clients using the Rational Application Developer wizard.
Note: If using the Rational Application Developer wizard, the client should be created under an EJB project using a stateless session bean facade to access the service, not in the Stores.war project. That is, if you define the Web Service client in the Stores Web Module, the service reference will not be visible if you are running outside the Stores context. For example, if you attempt to use the Web Service Client from a scheduler job, the call will fail.
- For further reference, see the following IBM Redbooks:
- IBM WebSphere Application Server V7.0 Web Services Guide
- Rational Application Developer V7.5 Programming Guide
The following diagram illustrates:
- The integration of the MyCompanyMember client API with the WebSphere Commerce user registration commands.
- The integration of the MyCompanyMember client API with the WebSphere Commerce messaging system.
- The consumption of the MyCompanyMemberServices Web service by WebSphere Commerce.
Learning objectives
- Create an outbound Web service client that integrates with a sample Web Service which manages users.
Time required
Expect this tutorial to take 4 hours to complete.
Audience
This tutorial is intended for WebSphere Commerce developers who are responsible for integrating WebSphere Commerce with an external system.
Prerequisites
Before beginning this tutorial ensure that you have fulfilled the following prerequisites:
- Installed WebSphere Commerce Developer.
To complete this tutorial you should be familiar with the following terms and concepts:
- Web services
- WebSphere Commerce Developer
- An understanding of the Java programming language.
- A basic understanding of the database type used in the WebSphere Commerce development environment.
- A basic understanding of access beans.
- A basic understanding of XML.
Lessons in this tutorial
- Set up the development environment for creating an outbound Web Service
This section is related to setting up the development environment for creating an outbound Web Service.
- Generate the MyCompanyMember data objects from the external system WSDL
In this step we will generate Java objects called service data objects (SDO) from the MyCompanyMemberServices.wsdl. These objects represent the request and response messages to the sample Web service.
- Implement the MyCompanyMember client API
In the step we will create the MyCompanyMember client API in the WebSphereCommerceServerExtensionsLogic project. This API uses the SDOs generated in the previous step to send request messages and handle response messages.
- Create a task command to send and receive messages
In this step, we will create a new task command that will build a PushUser request SDO, use the MyCompanyMember client API to transmit the message, and handle the PushUserConfirmation response SDO.
- Integrate the MyCompanyMember client API with WebSphere Commerce
This section is related to integrating the MyCompanyMember client API with WebSphere Commerce.
- Configure the WebSphere Commerce messaging system
In this step we will create a new message type for this tutorial and configure the new message type to point to the sample Web service.
- Generate the MyCompanyMemberServices sample user Web service
In this step we will generate the sample user Web service to test the client API and message configuration performed in the previous steps.
- Deploy and validating the MyCompanyMember client
In this step, you test the integration completed in the preceding steps by registering a user in the ConsumerDirect sample store. This generates and transmits a message with user registration information to the sample Web service.
- Create an outbound Web service client for WebSphere Commerce summary
This section summarizes the tutorial.
|