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.
In the Plants by WebSphere web services static inquiry on suppliers scenario, the Plants by WebSphere IT staff establishes connections with each supplier separately, and makes changes as suppliers come and go. It would be convenient to query multiple suppliers at the same time, without providing a list of particular suppliers to query. Furthermore, Plants by WebSphere managers would like to be able to shop around quickly according to criteria, such as the lowest wholesale price or fastest availability.
In this scenario, several plant and garden suppliers have published web services to a Universal Description, Discovery, and Integration. (UDDI) registry. Suppliers create inventory web services that use a standard interface. They publish their web services to the centralized registry. Perhaps the registry has been established by the Plant Wholesalers Association. Or maybe a small Internet company established the buyer-seller site after finding that suppliers and retailers each would pay a small monthly rate for the convenience of the service.
Plants by WebSphere also supports JavaBeans endpoints within the web container and enterprise beans endpoints by taking advantage of the JAX-WS programming model support. Using JAX-WS 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.
- In advance, the suppliers publish their web services to a UDDI registry for such an occasion.
In this way, they notify inquiring retailers, such as Plants by WebSphere, that their inventories are available to check.
- 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 UDDI4J client to consult the UDDI registry for suppliers whose inventories it can check.
Plants by WebSphere can invoke a web service that queries the UDDI registry for suppliers and the web service at the site of each supplier is invoked. The administrator is presented with a list of suppliers from which the requested item is available, including the price and availability data.
- Plants by WebSphere uses the web services to check the supplier inventories.
The application invokes a Web Services for Java EE client or a JAX-RPC 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.
The application invokes a JAX-RPC client, or a JAX-WS application client can be invoked, 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 does 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 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 issues 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.
- Java API for XML-based remote procedure call (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.
- UDDI registry
By publishing their web services to UDDI, suppliers make them available for Plants by WebSphere and other retailers to discover and reuse. This saves development time, effort and cost, and helps minimize the need to maintain several different implementations of the same application at Plants by WebSphere and various other retailers who need to contact the suppliers for inventory data.
Particular editions of WAS provide a private UDDI registry that can be used in an intranet environment.
Related:
Overview: Online garden retailer web services scenarios Web services online garden retailer scenario: Static inquiry on supplier Web services online garden retailer scenario: Cross supplier inquiry Task overview: Implementing web services applications Use the UDDI registry Web services specifications and APIs Samples page on IBM site