JAX and Web Services: The Great Car Parts Company Scenario Let's now look at how the Great Car Parts Company can leverage the Web services environment and the Java APIs for XML to meet its business needs. Recall that the Great Car Parts Company has decided to add mobile phone chargers to the list of items it sells. To buy the chargers, it discovers wholesalers for chargers, gets their price lists, decides on the best bid, and places procurement orders. In the Web services scenario, Jack, the procurement person, asks the company's information services team to design and develop a procurement application for him. The information services team decides to use Java and JAX to develop the procurement application. This is how the procurement application works: -
The application uses JAXR to send a query to the UDDI registry to find wholesalers for chargers. -
The UDDI registry receives the request and applies the search criteria specified in the JAXR code. -
The result, containing the list of wholesalers, is sent back to the client as a SOAP message. -
Using the results of the query, the application uses JAXM to request price lists from the different companies. -
Upon receiving the request, the wholesalers do a JAX-RPC on the manufacturer's Web service to find out about stock availability and possible price fluctuations. -
Based on the response to the JAX-RPC, the wholesalers respond back to Great Car Parts Company's requesting application with the prices in an XML document. -
The application uses JAXP to parse the price lists and decide on the company that quotes the lowest price as the chief supplier. -
The application creates an XML-based order form containing the number of mobile phone chargers it wants to buy. -
A JAXM message is created, and the order form is attached to it. This JAXM message is then sent to the company, which acknowledges the receipt of the order via JAXM. Now that the procurement part has been taken care of, the Great Car Parts Company has to update its Web site to reflect the new item, as well as the selling price. To do so, a combination of JSP and JAXP is used. The JSP page uses JAXP to get the price information from the lowest bidder's XML price sheet, raises the figure by 20%, then displays the price as an HTML page. |