title: CXF client exception: Interceptor for {XXX} has thrown exception, unwinding now
body: <p>I am encountering this following CXF exception:</p>
  
  <pre><code>warning: Interceptor for {http://example.com/wsdl/esc/2011-12-12/}AmazonEC2#{http://example.com/wsdl/esc/2011-12-12/}NewDescribeImages has thrown exception, unwinding now
  java.lang.NullPointerException
      at org.apache.cxf.binding.soap.interceptor.StartBodyInterceptor.handleMessage(StartBodyInterceptor.java:59)
      at org.apache.cxf.binding.soap.interceptor.StartBodyInterceptor.handleMessage(StartBodyInterceptor.java:37)
      at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:263)
      at org.apache.cxf.endpoint.ClientImpl.onMessage(ClientImpl.java:762)
      at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponseInternal(HTTPConduit.java:1582)
      at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponse(HTTPConduit.java:1467)
      at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.close(HTTPConduit.java:1375)
      at org.apache.cxf.io.CacheAndWriteOutputStream.postClose(CacheAndWriteOutputStream.java:47)
      at org.apache.cxf.io.CachedOutputStream.close(CachedOutputStream.java:188)
      at org.apache.cxf.transport.AbstractConduit.close(AbstractConduit.java:56)
      at org.apache.cxf.transport.http.HTTPConduit.close(HTTPConduit.java:623)
      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:510)
      at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:440)
      at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:343)
      at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:295)
      at org.apache.cxf.frontend.ClientProxy.invokeSync(ClientProxy.java:73)
      at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:124)
      at $Proxy31.newDescribeImages(Unknown Source)
      at test.App.main(App.java:62)
  javax.xml.ws.soap.SOAPFaultException: Fault string, and possibly fault code, not set
  </code></pre>
  
  <p>the code that causes this exception:</p>
  
  <pre><code>    MyService ms =new MyService ();
      MyServicePort port = ms.getAmazonEC2Port();
      BindingProvider bp = (BindingProvider) port;
      bp.getRequestContext()
              .put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
                      "http://192.180.33.12:8773/services/myservice_url/");
  
      Client client = ClientProxy.getClient(portType);
      client.getInInterceptors().add(new LoggingInInterceptor());
      client.getOutInterceptors().add(new LoggingOutInterceptor());
      Endpoint endpoint = client.getEndpoint();
  
      Map&lt;String, Object&gt; inProps=new HashMap&lt;String, Object&gt;();
      Map&lt;String,Object&gt; outProps = new HashMap&lt;String,Object&gt;();
      configWSProps(inProps, outProps); //here is some WS-Security properties
  
      WSS4JInInterceptor wssIn = new WSS4JInInterceptor(inProps);
      WSS4JOutInterceptor wssOut = new WSS4JOutInterceptor(outProps);
  
      endpoint.getInInterceptors().add(wssIn);
      endpoint.getOutInterceptors().add(wssOut);
  
      SomeResponseType response = port.someMethod();
  </code></pre>
  
  <p>This exception is thrown in the last line: port.someMethod().
  In the configWSProps(...) method I set some WS-Security properties, it is not likely to have problem here.</p>
  
  <p>I printed the cxf logs, i can see that the inbound message has the correct data.</p>
  
  <p>From the CXF source code, it seems that CXF fails to retrieve the soap message, but I don't know how to solve this. Please help me!</p>
  
  <p>here is the CXF source code:
  <a href="http://grepcode.com/file/repo1.maven.org/maven2/org.apache.cxf/cxf-rt-bindings-soap/2.4.1/org/apache/cxf/binding/soap/interceptor/StartBodyInterceptor.java/#59" rel="noreferrer">http://grepcode.com/file/repo1.maven.org/maven2/org.apache.cxf/cxf-rt-bindings-soap/2.4.1/org/apache/cxf/binding/soap/interceptor/StartBodyInterceptor.java/#59</a></p>