This Confluence has been LDAP enabled, if you are an ASF Committer, please use your LDAP Credentials to login. Any problems file an INFRA jira ticket please.

Child pages
  • Developing JAX-RPC Web Services

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migration of unmigrated content due to installation of a new plugin

...

This tutorial will take you through the steps required in developing, deploying and testing a Web Service in Apache Geronimo. After completing this tutorial you should be able to understand how to develop simple JAX-RPC compliant web services in Apache Geronimo using Eclipse development environment.

...

  1. Right click on JavaRsources:src and select New->Package





  2. Name the package to org.apache.geronimo.samples.jaxrpc and click Finish





  3. Right click on the new package and select New->Interface





  4. Name the interface as Converter and click Finish





  5. Add the following code to the Converter class Converter.javasolid package org.apache.geronimo.samples.jaxrpc; import java.math.BigDecimal; import java.rmi.Remote; import java.rmi.RemoteException; public interface Converter extends Remote{ public BigDecimal dollarToRupees(BigDecimal dollars) throws RemoteException; public BigDecimal rupeesToEuro(BigDecimal rupees) throws RemoteException; }
  1. Right click on the new package and select New->Class





  2. Name the class as ConverterImpl and click Finish





  3. Add the following code to the ConverterImpl class ConverterImpl.javasolid package org.apache.geronimo.samples.jaxrpc; import java.math.BigDecimal; import java.rmi.RemoteException; public class ConverterImpl implements Converter{ private BigDecimal rupeeRate = new BigDecimal("40.58"); private BigDecimal euroRate = new BigDecimal("0.018368"); public BigDecimal dollarToRupees(BigDecimal dollars) throws RemoteException { BigDecimal result = dollars.multiply(rupeeRate); return result.setScale(2, BigDecimal.ROUND_UP); } public BigDecimal rupeesToEuro(BigDecimal rupees) throws RemoteException { BigDecimal result = rupees.multiply(euroRate); return result.setScale(2, BigDecimal.ROUND_UP); } }

This completes the development of Web Services implementation code.

...

  • Expand WEB-INF directory and add the following code to web.xml web.xmlsolid <?xml version="1.0" encoding="UTF-8"?> <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID" version="2.5"> <display-name>jaxrpc-converter</display-name> <servlet> <display-name>JAX-RPC Converter Service</display-name> <servlet-name>JAXRPCConverterService</servlet-name> <servlet-class> org.apache.geronimo.samples.jaxrpc.ConverterImpl </servlet-class> </servlet> <servlet-mapping> <servlet-name>JAXRPCConverterService</servlet-name> <url-pattern>/converter</url-pattern> </servlet-mapping> </web-app>
  • Now we need to create some additional files which will configure and describe the service

...