soapjax-ws

How does jaxws-ri route a SOAP request to the correct method while SOAPAction HTTP header is empty string?


I am using jaxws-ri, version 2.3.2, on Tomcat

I have simple class with some JAX-WS annotations:

@WebService()
public class Test {

    @WebMethod()
    public String validateCard(String id) {
        return "validateCard echo: " + id;
    }
    
    @WebMethod()
    public String saveVisit(String id) {
        return "saveVisit echo: " + id;
    }
}

The generated WSDL:

<binding name="..." type="...">
  <soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/>
  <operation name="validateCard">
    <soap:operation soapAction=""/>
    ...
  <operation name="saveVisit">
    <soap:operation soapAction=""/>
    ...

When I perform some test SOAP requests to each operation (using soapUI, all successful), the HTTP SOAPAction header is empty string in both cases (this is in line with the WSDL).

My question: How does JAX-WS route a SOAP request to the correct method, while SOAPAction HTTP header is empty string?


Solution

  • It looks inside the SOAP message for the operation name.

    SOAPAction header is usually for the surrounding infrastructure of the web service (for firewalls, fast routing), the web service itself doesn't necessarily need it (although it may complain if it doesn't get it or is of some unexpected value).

    See a bit more of details in this question: SOAP headers versus HTTP headers