SOAP is a common protocol for services that is rather complex and heavy. It allows to build inter-operable and well specified services (see WSDL). SOAP is transport neutral what is not only an advantage. We strongly recommend to use HTTPS transport and ignore additional complex standards like WS-Security and use established HTTP-Standards such as RFC2617 (and RFC5280).
For building web-services with Java we use the JAX-WS standard. There are two approaches:
-
code first
-
contract first
Here is an example in case you define a code-first service.
We define a regular interface to define the API of the service and annotate it with JAX-WS annotations:
@WebService
public interface TablemanagmentWebService {
@WebMethod
@WebResult(name = "message")
TableEto getTable(@WebParam(name = "id") String id);
}
And here is a simple implementation of the service:
@Named
@WebService(endpointInterface = "com.devonfw.application.mtsj.tablemanagement.service.api.ws.TablemanagmentWebService")
public class TablemanagementWebServiceImpl implements TablemanagmentWebService {
private Tablemanagement tableManagement;
@Override
public TableEto getTable(String id) {
return this.tableManagement.findTable(id);
}
For testing SOAP services in general consult the testing guide.
For testing SOAP services manually we strongly recommend SoapUI.