:toc: macro
toc::[]

= SOAP
https://en.wikipedia.org/wiki/SOAP[SOAP] is a common protocol for link:guide-service-layer[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).
//There is no SOAP example in our application -maybe keep this as a general example?-

== JAX-WS
For building web-services with Java we use the https://jcp.org/en/jsr/detail?id=224[JAX-WS] standard.
There are two approaches:

* code first
* contract first

Here is an example in case you define a code-first service.

=== Web-Service Interface
We define a regular interface to define the API of the service and annotate it with JAX-WS annotations:
[source,java]
--------
@WebService
public interface TablemanagmentWebService {

  @WebMethod
  @WebResult(name = "message")
  TableEto getTable(@WebParam(name = "id") String id);

}
--------

=== Web-Service Implementation

And here is a simple implementation of the service:
[source,java]
--------
@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);
  }
--------

== SOAP Custom Mapping
In order to map custom link:guide-datatype[datatypes] or other types that do not follow the Java bean conventions, you need to write adapters for JAXB (see link:guide-xml[XML]).

== SOAP Testing
For testing SOAP services in general consult the link:guide-testing[testing guide].

For testing SOAP services manually we strongly recommend http://www.soapui.org/[SoapUI].
