Java Reference
In-Depth Information
class has a method named calculatePower that returns the power of an argument
as shown in the following highlighted code:
package
com.packtpub.as7development.chapter8.webservice;
public class POJOWebService
{
public double calculatePower(double
argument,
double power)
{
return Math.pow(argument,power);
}
}
Now we will turn this simple class into a web service by adding the mandatory @We-
bService annotation.
package
com.packtpub.as7development.chapter8.webservice;
import javax.jws.WebMethod;
import javax.jws.WebParam;
import javax.jws.WebResult;
import javax.jws.WebService;
import javax.jws.soap.SOAPBinding;
import javax.servlet.annotation.*;
@WebService(targetNamespace =
"http://www.packtpub.com/",
serviceName = "CalculatePowerService")
@SOAPBinding(style = SOAPBinding.Style.RPC)
@WebServlet(name="POJOService", urlPatterns={"/
pojoService"} )
public class POJOWebService
{
Search WWH ::




Custom Search