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.
Plants by WebSphere is an Internet storefront that sells plants and gardening supplies. The company realizes that its existing web application can be "wrapped" with web services programming interfaces. For example, the BackOrderStock session bean can be turned into a SOAP web services client that interacts with a Supplier Web services application located at the supplier. Specifically, the BackOrderStock session bean functionality is turned into a Web Services for Java EE client and a JAX-RPC client.
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.
How out of stock items are handled
The following events happen when a customer on the Plants by WebSphere site orders an item that is not available according to the Plants by WebSphere inventory:
- Plants by WebSphere checks its own inventory.
The application powering the website checks the Plants by WebSphere inventory database. It discovers that the item is not in stock.
- Plants by WebSphere uses a web service to check the supplier inventory.
The application invokes a SOAP client that communicates with a SOAP server at the supplier site to ascertain whether the supplier has the item in stock. The supplier data is sent to Plants by WebSphere.
- Plants by WebSphere either obtains the out of stock item, or does not.
If the supplier indicates that the item is in stock, the application powering Plants by WebSphere determines whether to order the item on behalf of the customer. The exchange of data can include checking a price threshold beyond which Plants by WebSphere will not order the wholesale item. It could also include decision-making information such as how long the supplier requires to deliver the item, or a date that the manufacturer plans to discontinue the item.
- Plants by WebSphere notifies its customer of the outcome, as soon as possible.
If the supplier can be consulted quickly enough, Plants by WebSphere does not have to bother its customer with concerns about availability. It simply confirms that the item is available, as though the item is in stock at Plants by WebSphere. If the supplier inventory temporary lacks the item, or Plants by WebSphere opted not to order the item from the supplier, Plants by WebSphere can issue an appropriate response to the customer.
Web services technologies used in this scenario
This scenario uses the following web services technologies.
- XML (Extensible Markup Language)
- XML is used to standardize the exchange of data between Plants by WebSphere and its supplier.
- Web Services for Java EE
- Web Services for Java EE, also known as JSR-109, defines how Java EE applications create and access web services.
- JAX-RPC
- JAX-RPC, also known as JSR-101, defines how Java applications access web services.
- 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.
- WSDL (Web Services Description Language)
- WSDL is used to turn the existing application into a web service, by acting as the interface between the underlying application and other Web-enabled applications.
- SOAP
- SOAP is the protocol by which the web service communicates with the supplier over the Internet.
Related:
Overview: Online garden retailer web services scenarios Web services online garden retailer scenario: Dynamic inquiry on supplier Web services online garden retailer scenario: Cross supplier inquiry Task overview: Implementing web services applications Web services specifications and APIs Samples page on IBM site