javaspringspring-ws

Spring WS produces notification instead of request-response


I've been attempting to create a port of an existing JAX-WS Web Service in Spring, using Spring WebService (following their guide loosely at https://spring.io/guides/gs/producing-web-service/).

I've got an endpoint working, using both the XSD the existing application (with JAX-WS) uses, and by generating a new set with SoapUI.

For some reason, the Web Service seems to be publishing with the Type of 'Notification', rather than 'Request-Response' like the original, existing methods on the pre-existing JAX-WS endpoint. The Spring WS also has an 'Output' with a Response-suffixed class stated, where the JAX-WS one does not. This is visually different in SoapUI with the Spring wsdl having a red 'left arrow' next to each method, instead of the contraflow arrows.

I think this is manifesting itself as an issue I'm seeing when I call the one endpoint I have set up - an error is logged stating 'No endpoint mapping found for [SaajSoapMessage .... myEndpointMethodResponse" (e.g. the response object from the endpoint method, not the endpoint method itself).

As mentioned, I feel like the 'Type' on the methods is the smoking gun, but I can't see what is causing it. I have looked up the issue but can't find anything common?

Update The following helped with the request-response (Invalid wsdl generated by spring-ws when the request element doesn't end with 'Request'), but I'm now getting a response back in SOAPUI of 'No adapter for endpoint' referencing my Response class. The PayloadRoot and ResponsePayload match the wsdl objects exactly.


Solution

  • I've managed this myself now and will post the solution. There were two parts:

    1. As per the 'update' in the question, the Request methods in the XSD were named after the method, and weren't suffixed 'Request'. This meant that I had to make a custom WSDL11Definition class that would allow the setRequestSuffix to be null (empty). The question link has more details.

    2. The objects on the method needed to be wrapped in JAXBElement<> in order to recognise the input and output successfully.

    One all the above had been done, my breakpoint was hit in my IDE using SOAPUI.