Uploaded image for project: 'Spring Web Services'
  1. Spring Web Services
  2. SWS-867

MethodReturnValueHandler implementations should support null return values from endpoints


    • Type: Improvement
    • Status: Resolved
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 2.1.4
    • Fix Version/s: 2.2.RC1
    • Component/s: OXM
    • Labels:


      Here is an example Endpoint...

      public class WsDiscovery {
          private static final String ENDPOINT_REFERENCE = "uuid:f7a32a18-5205-46f1-b296-e0f6ac9de7ed";
          @Action(value = "http://schemas.xmlsoap.org/ws/2005/04/discovery/Resolve", output = "http://schemas.xmlsoap.org/ws/2005/04/discovery/ResolveMatches")
          public @ResponsePayload JAXBElement<ResolveMatchesType> handleResolve(@RequestPayload JAXBElement<ResolveType> element) {
              if (ENDPOINT_REFERENCE.equals(element.getValue().getEndpointReference().getAddress())) {
                  return new ObjectFactory().createResolveMatches(new ResolveMatchesType());
              return null;

      In the case where we the ENDPOINT_REFERENCE doesn't match, we don't want to send a response at all, and so the method returns 'null'. However, in all but the AbstractPayloadSourceMethodProcessor implementations, either a NullPointerException or IllegalArgumentException (from the Assert.notNull) will be thrown.

      I believe handling null return values by suppressing the sending of a response is the most consistent approach, given that this is what Spring MVC does.


        mccarl Phil McCarley created issue -
        arjen.poutsma Arjen Poutsma made changes -
        Field Original Value New Value
        Assignee Arjen Poutsma [ arjen.poutsma ]
        arjen.poutsma Arjen Poutsma made changes -
        Fix Version/s 2.2 [ 12850 ]
        arjen.poutsma Arjen Poutsma made changes -
        Resolution Fixed [ 1 ]
        Status Open [ 1 ] Resolved [ 5 ]


          • Assignee:
            arjen.poutsma Arjen Poutsma
            mccarl Phil McCarley
          • Votes:
            0 Vote for this issue
            2 Start watching this issue


            • Created: