Uploaded image for project: 'CXF'
  1. CXF
  2. CXF-3926

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

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 2.4.4
    • 2.4.5, 2.5.1
    • JAX-WS Runtime
    • None
    • Unknown

    Description

      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.

      Attachments

        Activity

          People

            ay Akitoshi Yoshida
            ay Akitoshi Yoshida
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: