Supporting JAXWS Provider's null response handling (the provider's invoke may 
return a null to indicate no response should be sent back)
----------------------------------------------------------------------------------------------------------------------------------------

                 Key: CXF-3926
                 URL: https://issues.apache.org/jira/browse/CXF-3926
             Project: CXF
          Issue Type: Improvement
          Components: JAX-WS Runtime
    Affects Versions: 2.4.4
            Reporter: Aki Yoshida
            Assignee: Aki Yoshida
            Priority: Minor
             Fix For: 2.4.5, 2.5.1


Jaxws 2.2 section 5.1.1 states:
"When an invoke method returns null, it is considered that no response needs to 
be sent by service."

This use case assumes there is no information about the operation's MEP (no 
wsdl, no java annotation).

CXF currently is throwing an exception in this case as it tries to serialize 
the null object in its response (or outbound) chain processing.

21.11.2011 11:56:08 org.apache.cxf.phase.PhaseInterceptorChain doDefaultLogging
WARNUNG: Interceptor for 
{http://server.any.test.tmp/}GreeterService#{http://server.any.test.tmp/}invoke 
has thrown exception, unwinding now
java.lang.NullPointerException
        at org.apache.cxf.staxutils.StaxUtils.copy(StaxUtils.java:418)
        at 
org.apache.cxf.databinding.source.XMLStreamDataWriter.write(XMLStreamDataWriter.java:88)
        at 
org.apache.cxf.databinding.source.XMLStreamDataWriter.write(XMLStreamDataWriter.java:50)
        at 
org.apache.cxf.databinding.source.XMLStreamDataWriter.write(XMLStreamDataWriter.java:46)
        at 
org.apache.cxf.interceptor.AbstractOutDatabindingInterceptor.writeParts(AbstractOutDatabindingInterceptor.java:119)
        at 
org.apache.cxf.interceptor.BareOutInterceptor.handleMessage(BareOutInterceptor.java:68)
        ...

To support the behavior given by the above paragraph, we need to handle this 
condition, whether a provider based service is returning a null, and if so, 
return no response content (i.e, HTTP 202 with no content) instead of throwing 
an exception and returning a SOAP fault.

To be compatible with the old behavior (i.e, throwing an exception), we can 
introduce a runtime property to enable or disable this provider's null response 
behavior.



--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to