Overview: Online garden retailer web services scenarios
This set of scenarios is inspired by an online retailer called Plants by WebSphere . Plants by WebSphere uses web services support in WAS to improve communications with its suppliers. The more advanced scenarios describe web services support available only in particular editions of the application server. Consult the product documentation to confirm what is supported by your edition.
We might recognize Plants by WebSphere as a sample application available in the Samples section of the Information Center. These scenarios are loosely related. They describe how the fictional online retailer could use a variety of web services technologies, some of which are beyond those currently demonstrated by the sample.
Web services are middleware. Using web services we can connect applications together, no matter how each application is implemented or where it is located. For example, web services can connect retailers to wholesale suppliers. Middleware is not new. What is new in Web services is that this connectivity is based upon open standards and web technologies. Web services operate at a level of abstraction that is similar to the Internet, and they can work with any operating system, hardware platform, or programming language that can be Web-enabled.
The Plants by WebSphere storefront sells plants and gardening supplies. As customers order merchandise, the site checks the merchandise availability in its inventory database. The scenarios show how the inventory system can grow in stages, using various web services technologies to improve its capabilities.
- Before web services
The Plants by WebSphere application already has web services capabilities. See the following for a description of how the online garden retailer might have operated prior to adopting web services technology. Key web services components are introduced. To determine which components are available your particular editions of WAS, consult the documentation for each edition.
- Static inquiry on supplier
In this scenario, the garden retailer turns the existing web application into a web service for checking the inventory of its main wholesale garden supplier.
- Dynamic inquiry on supplier
In this scenario, the garden retailer uses web services to perform an inventory search of several wholesale suppliers.
- Cross supplier inquiry
In this scenario, the garden retailer makes its web service available for use by others who need the service.
At present, these scenarios provide descriptions rather than step by step instructions. To gain experience with web services coding, see the sample application. It provides detailed instructions for building, configuring, and running the Plants by WebSphere sample application and others.
Before web services
Suppose that the Plants by WebSphere storefront does not use web services. The garden retailer has established an impressive Internet storefront enabling customers to shop and order merchandise. To determine whether a customer order can be filled, web applications rely on enterprise beans to query the Plants by WebSphere inventory database. If the item is in stock, the site confirms the order to the customer.
If a customer orders an item that is out of stock, the site notifies the customer that the item is out of stock, and encourages the customer to place the item on backorder. Later, long after the customer has left the Plants by WebSphere site, the site administrator or inventory manager might call or fax the supplier to obtain more inventory.
Introducing web services
Use web services provides Plants by WebSphere an automated way to have out of stock items shipped to its warehouse or directly to customers. If suppliers can be contacted quickly enough, Plants by WebSphere does not have to inform its customers that the item was out of stock. Plants by WebSphere can begin to reduce its own inventory if doing so is a desirable business move.
Web services is built on the following core technologies:
- XML
XML solves the problem of data independence. We use XML to describe data and to map that data into and out of any application or programming language.
To have their applications exchange information such as merchandise price and availability, Plants by WebSphere and its supplier place the data in a set of XML tags to which both parties agree.
- WSDL (Web Services Description Language)
We use this XML-based language to create a description of an underlying application. This WSDL document contains the description of the application and it is this description that turns an application into a web service, by acting as the interface between the underlying application and other Web-enabled applications.
Plants by WebSphere has an application capable of querying the supplier inventory. To enable communication with the supplier over the Internet, the company turns the application into a web service.
- SOAP
SOAP is the core communications protocol for the Web, and most web services use this protocol to talk to each other.
SOAP is an XML format for web services requests. According to the SOAP specification, SOAP is a lightweight protocol for exchange of information in a decentralized, distributed environment. It is an XML-based protocol that consists of three parts: an envelope that defines a framework for describing what is in a message and how to process it, a set of encoding rules for expressing instances of application-defined data types, and a convention for representing remote procedure calls and responses. SOAP can potentially be used in combination with a variety of other protocols; however, the only bindings defined in this document describe how to use SOAP in combination with HTTP and HTTP Extension Framework.
Because they are external to the Plants by WebSphere intranet, communications with its suppliers utilize SOAP over HTTP. Web services operating within the company intranet can use other transports, such as local Java bindings. The Web Services Invocation Framework (WSIF) component described later in this section can help Plants by WebSphere applications dynamically choose the optimal transport mechanism for a given situation.
- Web Services for Java EE
The Web Services for Java EE specification, also known as JSR-109, defines how Java EE applications create and access web services.
Read about implementing web services applications to learn how to implement a web service interface to an existing application, and deploy the web service within the application server.
- JAX-WS
The JAX-WS programming model simplifies application development through support of a standard, annotation-based model to develop web services applications and clients. The JAX-WS programming model is the successor to the JAX-RPC 1.1 programming model.
The application server supports both the JAX-WS and JAX-RPC programming models.
- Java Architecture for XML Binding (JAXB)
JAXB is a Java technology that provides and way to map Java classes and XML schema in the development of web services applications. JAXB leverages platform-neutral XML data to bind XML schema to Java applications without requiring extensive knowledge of XML programming.
- Java API for XML-based remote procedure call (JAX-RPC)
JAX-RPC, also known as JSR-101, defines how Java applications access web services.
The application server supports web services based on the JAX-WS and JAX-RPC programming models. JAX-WS is a new programming model that simplifies application development through support of a standard, annotation-based model to develop web services applications and clients. A JAX-RPC client and JAX-WS client can be used in the same module; therefore, the online retailer is still able to use its JAX-RPC applications. The application server makes it easy to configure and reuse configurations, so we can incorporate new Web services profiles. The JAX-WS standards support interoperable and reliable web services applications. The online retailer can send messages asynchronously, which means that the messages can communicate reliably even if one of the parties is temporarily offline, busy, or not available. By using these new technologies, the online retailer can be confident that its communication is reliable and reaches its destination while interoperating with other vendors.
Refer to the Samples section of the Information Center for additional Samples that demonstrate JAX-WS and JAX-RPC web services.
WebSphere software provides additional specifications and standards to help we get the most out of our web services.
For a complete list of the supported standards and specifications, see the web services specifications and API documentation.
Subtopics
- Web services online garden retailer scenario: Static inquiry on supplier
In this scenario, an online supply retailer turns an application into a web service for checking the inventory of its main supplier.- Web services online garden retailer scenario: Dynamic inquiry on supplier
This document describes a scenario in which an online garden supply retailer uses web services to perform an inventory search of several wholesale suppliers.- Web services online garden retailer scenario: Cross supplier inquiry
This document describes a scenario in which an online garden supply retailer uses web services to integrate its inventory system with the inventory systems of other retailers. Also using web services, the main Internet storefront can check supplier inventories on behalf of itself or other retailers.
Related:
Accessing the samples Example: Installing a web services sample with the console Task overview: Implementing web services applications Web services specifications and APIs Samples page on IBM site XML specification on www.w3.org WSDL specification on www.w3.org SOAP specification on www.w3.org