THIS IS A TEST INSTANCE. ALL YOUR CHANGES WILL BE LOST!!!!
...
- Right click on ejbModule and select New->Package
- Name the package to org.apache.geronimo.samples.jaxws and click Finish
- Right click on the new package and select New->Interface
- Name the interface as Converter and click Finish
- Add the following code to the Converter class
Code Block title Converter.java borderStyle solid package org.apache.geronimo.samples.jaxws; import java.math.BigDecimal; import javax.ejb.Remote; import javax.jws.WebService; @Remote @WebService(name = "ConverterPortType", targetNamespace = "http://jaxws.samples.geronimo.apache.org") public interface Converter { public BigDecimal dollarToRupees(BigDecimal dollars); public BigDecimal rupeesToEuro(BigDecimal rupees); }
- Right click on the new package and select New->Class
- Name the class as ConverterBean and click Finish
- Add the following code to the ConverterBean class
Code Block title ConverterBean.java borderStyle solid package org.apache.geronimo.samples.jaxws; import java.math.BigDecimal; import javax.ejb.*; import javax.jws.WebService; @Stateless @WebService(serviceName = "Converter", portName = "ConverterPort", endpointInterface = "org.apache.geronimo.samples.jaxws.Converter", targetNamespace = "http://jaxws.samples.geronimo.apache.org" ) public class ConverterBean implements Converter { private BigDecimal rupeeRate = new BigDecimal("40.58"); private BigDecimal euroRate = new BigDecimal("0.018368"); public BigDecimal dollarToRupees(BigDecimal dollars) { BigDecimal result = dollars.multiply(rupeeRate); return result.setScale(2, BigDecimal.ROUND_UP); } public BigDecimal rupeesToEuro(BigDecimal rupees) { BigDecimal result = rupees.multiply(euroRate); return result.setScale(2, BigDecimal.ROUND_UP); } }
...