I must prepare a webservice to accept anan already defined wsdl structure. I followed the tutorial found here, with source code for the test project downloadable here.
@PayloadRoot(namespace = "URI", localPart = "LOCAL_PART")
@ResponsePayload
public JAXBElement retrieveNextStatesRequest(@RequestPayload Request request) {
// Logic
return new Response();
}
The jaxb2-maven-plugin however has no possibility to add a XmlRoot annotation. However it provides an ObjectFactory to generate instances wrapped in JAXBElement instances.
So when changes the method accordingly the SOAP requests now work as expected:
@PayloadRoot(namespace = "URI", localPart = "LOCAL_PART")
@ResponsePayload
public Response retrieveNextStatesRequest(@RequestPayload Request request) {
// Logic
return new ObjectFactory.createResponse(new Response());
}