Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MethodReturnValueHandler implementations should support null return values from endpoints [SWS-867] #941

Closed
gregturn opened this issue Mar 19, 2014 · 1 comment

Comments

@gregturn
Copy link
Contributor

Phil McCarley opened SWS-867 and commented

Here is an example Endpoint...

@Endpoint
@Address("urn:schemas-xmlsoap-org:ws:2005:04:discovery")
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.


Affects: 2.1.4

Referenced from: commits 06ff649

@gregturn
Copy link
Contributor Author

Arjen Poutsma commented

Fixed!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants