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.
F
I had the same error. My setup was as follows:
Generation of classes from an existing XSD file using the maven jaxb2-maven-plugin
org.codehaus.mojo
jaxb2-maven-plugin
2.5.0
xjc
xjc
com.company
true
true
The handler method:
@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());
}