I'm developing a contract-first SOAP web service in Spring Boot according to an externally provided WSDL file, and generating POJOs and endpoint interfaces from that WSDL by using this Gradle wsdl2java plugin. The service is up and running and able to receive requests and deserialize the XML, but it should respond asynchronously (that is, read wsa:ReplyTo
headers from incoming messages, synchronously respond with a HTTP 202 or 500 depending on whether XML deserialization was successful, then begin processing the deserialized object and, when that's done, send a response to the indicated address), and I can't quite figure out how to get that header.
The solution I've seen when googling would be to add a @SoapHeader
-annotated parameter to the endpoint method, but I can't do that because the endpoint interface is generated from the WSDL and there is no such parameter in the interface. That header is also not mentioned in the WSDL itself, and I'm not sure if it should be (I'm new to the world of SOAP). Should I request changes to the WSDL, switch to another method of generating my code, or do something else?
For reference, the generated endpoint interface and implementation class:
@WebService(targetNamespace = "...", name = "SOAPWS")
@XmlSeeAlso({/* not relevant */})
@SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.BARE)
public interface SOAPWS{
@WebMethod(operationName = "method", action = "...")
@Oneway
public void method(
@WebParam(partName = "param", name = "...", targetNamespace = "...")
ParamType param
);
}
@Endpoint
public class SOAPWSImpl implements SOAPWS {
private static final String NAMESPACE_URI = "...";
@Override
@PayloadRoot(localPart = "...", namespace = NAMESPACE_URI)
public void method(@RequestPayload ParamType param) {
// implementation
}
}