Developing web services with Jakarta XML Web Services
Jakarta XML Web Services is a high-level API that simplifies the development of SOAP-based web services. Developing a web service with Jakarta XML Web Services consists of writing a class with public methods to be exposed as web services. The class needs to be annotated with @WebService. All public methods in the class are automatically exposed as web services; they can optionally be annotated with @WebMethod. The following example illustrates this process:
package com.ensode.jakartaeebook.xmlws;
import jakarta.jws.WebMethod;
import jakarta.jws.WebService;
@WebService
public class Calculator {
@WebMethod
public int add(int first, int second) {
return first + second;
}
@WebMethod
public int subtract(int first, int second) {
return first - second;
}
} The preceding class exposes its two methods as web services...