JAX-RPC Web services |
|
|
![]() |
|
Configure and run | Technotes | Javadoc | Build with Ant |
Getting started |
Locating source code |
Reviewing coding notes |
This sample illustrates migration of a client from Simple Object Access Protocol (SOAP) to the Java(TM) API for XML-based RPC (JAX-RPC). The GetQuote.java client class of the StockQuote sample has been annotated to describe how to modify an Apache SOAP client to use the JAX-RPC Dynamic Invocation Interface (DII) introduced by Web services enterprise bean. The Apache SOAP client is available in WebSphere Application Server Version 4.0 and Version 5.0. Refer to the GetQuote.java code for details.
The Stock Quote service uses an EJB to implement a Web service. The Sample includes a J2SE client, samples.stock.GetQuote, and a J2EE application client, com.ibm.websphere.samples.webservices.stock.GetQuoteClient.
The Java code for the annotated J2SE GetQuote client is located in the profile_root/samples/src/WebServicesSamples/Clients/simpleClients/samples/stock directory.
The Java code for the Stock Quote EJB application is located in the profile_root/samples/src/WebServicesSamples/stockEJB directory.
The Java code for the J2EE GetQuote client is located in the profile_root/samples/src/WebServicesSamples/Clients/applicationClients/getQuoteClient/com/ibm/websphere/samples/webservices/stockClient directory.
z/OS customers: The source code tree for Samples is not provided on the z/OS platform because Sample applications are not built on the z/OS platform.
The interesting Java code for the Stock Quote enterprise bean application is the implementation of the EJB. This code is in StockQuoteBean.java. When the client is invoked with a stock quote symbol the implementation attempts to contact the http://services.xmethods.net/axis/getQuote service to obtain the current stock price. The stock quote implementation returns that price to the client, or returns -1.0 if unsuccessful. If the stock symbol passed in by the calling client is XXX the implementation returns a fixed number, 55.25.
The J2SE GetQuote client provides a comparison of the JAX-RPC client with the earlier SOAP version. Refer to the GetQuote code in the simpleClients/samples/stock directory.