@WebServiceProvider returns invalid SOAP response when using CXF

Solution Verified - Updated -

Issue

  • When making a request with a CXF client to a CXF endpoint, I get the following error:
Aug 29, 2012 9:56:46 AM org.apache.cxf.phase.PhaseInterceptorChain doDefaultLogging
WARNING: Interceptor for {http://aaa.bbb/soapheader/inband}InBandSoapHeaderService#{http://cio.xyz.com/soapheader/inband}FooCallbackPoll has thrown exception, unwinding now
java.lang.IndexOutOfBoundsException: Index: 4, Size: 4
        at java.util.ArrayList.rangeCheck(ArrayList.java:615)
        at java.util.ArrayList.get(ArrayList.java:393)
        at org.apache.cxf.message.MessageContentsList.get(MessageContentsList.java:79)
        at org.apache.cxf.jaxws.interceptors.HolderInInterceptor.handleMessage(HolderInInterceptor.java:69)
        at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:263)
        at org.apache.cxf.endpoint.ClientImpl.onMessage(ClientImpl.java:795)
        at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponseInternal(HTTPConduit.java:1626)
        at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponse(HTTPConduit.java:1493)
        at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.close(HTTPConduit.java:1401)
        at org.apache.cxf.io.CacheAndWriteOutputStream.postClose(CacheAndWriteOutputStream.java:47)
        at org.apache.cxf.io.CachedOutputStream.close(CachedOutputStream.java:194)
        at org.apache.cxf.transport.AbstractConduit.close(AbstractConduit.java:56)
        at org.apache.cxf.transport.http.HTTPConduit.close(HTTPConduit.java:648)
        at org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingInterceptor.handleMessage(MessageSenderInterceptor.java:62)
        at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:263)
        at org.apache.cxf.endpoint.ClientImpl.doInvoke(ClientImpl.java:531)
        at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:461)
        at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:364)
        at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:317)
        at org.apache.cxf.frontend.ClientProxy.invokeSync(ClientProxy.java:88)
        at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:134)
        at $Proxy27.fooCallbackPoll(Unknown Source)
        at com.aaa.bbb.inbandsh.InBandSHWSSClient.main(InBandSHWSSClient.java:151)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:88)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:55)
        at java.lang.reflect.Method.invoke(Method.java:613)
        at org.jboss.modules.Module.run(Module.java:270)
        at org.jboss.modules.Main.main(Main.java:294)

Upon analysis of the response message, it appears the body is empty:

<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
   <SOAP-ENV:Header>
      <FooResponseHeader xmlns:ns2="http://cxf.apache.org/soapheader/test">FooResponseHeader</FooResponseHeader>
      <ns2:FooResponse xmlns:ns2="http://cxf.apache.org/soapheader/test">
         <ns2:Return>Foo Response Body</ns2:Return>
      </ns2:FooResponse>
   </SOAP-ENV:Header>
   <SOAP-ENV:Body/>
</SOAP-ENV:Envelope>

Note that the CXF endpoint is implemented as a @WebServiceProvider

Environment

  • JBoss Enterprise Application Platform
    • 6.0
    • 5.x

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content