title: org.apache.cxf.interceptor.Fault: Unmarshalling Error: Illegal character (NULL, unicode 0) encountered: not valid in any content
body: <p>I am using a cxf webservice which uses local transport and accessing the webservice from java application.
  Webservice is  reading a file and sending through webservice call. I am using the byte size as 512. Suppose the file size is 1200. First two attempt of retrieving the file is success and for the last chunk i am getting org.apache.cxf.interceptor.Fault: Unmarshalling Error: Illegal character (NULL, unicode 0) encountered: not valid in any content.</p>
  
  <p>Here chunk represents 512 bytes. I am converting bytes to string and returning from web service.In the last chunk only 16 byte value is filled and remaining are filled with zeros.
  Any help will be appreciated. 
  I am using cxf webservice 2.7.5, jdk1.7 ,Redhat Linux.</p>
  
  <p>Stack trace:</p>
  
  <pre><code>org.apache.cxf.interceptor.Fault: Unmarshalling Error: Illegal character (NULL, unicode 0) encountered: not valid in any content
   at [row,col {unknown-source}]: [2,1]
          at org.apache.cxf.jaxb.JAXBEncoderDecoder.unmarshall(JAXBEncoderDecoder.java:808)
          at org.apache.cxf.jaxb.JAXBEncoderDecoder.unmarshall(JAXBEncoderDecoder.java:629)
          at org.apache.cxf.jaxb.io.DataReaderImpl.read(DataReaderImpl.java:157)
          at org.apache.cxf.interceptor.DocLiteralInInterceptor.handleMessage(DocLiteralInInterceptor.java:103)
          at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:271)
          at org.apache.cxf.endpoint.ClientImpl.onMessage(ClientImpl.java:800)
          at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponseInternal(HTTPConduit.java:1592)
          at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponse(HTTPConduit.java:1490)
          at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.close(HTTPConduit.java:1309)
          at org.apache.cxf.transport.AbstractConduit.close(AbstractConduit.java:56)
          at org.apache.cxf.transport.http.HTTPConduit.close(HTTPConduit.java:622)
          at org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingInterceptor.handleMessage(MessageSenderInterceptor.java:62)
          at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:271)
          at org.apache.cxf.endpoint.ClientImpl.doInvoke(ClientImpl.java:530)
          at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:463)
          at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:366)
          at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:319)
          at org.apache.cxf.frontend.ClientProxy.invokeSync(ClientProxy.java:96)
          at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:133)
          at $Proxy62.getJobLog(Unknown Source)
          at com.java.process.AClass.getMessage(AClass.java:468)
          at com.java.process.AClass.getXXXX(AClass.java:156)
          at com.java.process.AClass.main(CLIClientStartup.java:409)
  Caused by: javax.xml.bind.UnmarshalException
   - with linked exception:
  [com.ctc.wstx.exc.WstxUnexpectedCharException: Illegal character (NULL, unicode 0) encountered: not valid in any content
   at [row,col {unknown-source}]: [2,1]]
          at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.handleStreamException(UnmarshallerImpl.java:436)
          at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal0(UnmarshallerImpl.java:372)
          at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal(UnmarshallerImpl.java:349)
          at org.apache.cxf.jaxb.JAXBEncoderDecoder.doUnmarshal(JAXBEncoderDecoder.java:769)
          at org.apache.cxf.jaxb.JAXBEncoderDecoder.access$100(JAXBEncoderDecoder.java:94)
          at org.apache.cxf.jaxb.JAXBEncoderDecoder$1.run(JAXBEncoderDecoder.java:797)
          at java.security.AccessController.doPrivileged(Native Method)
          at org.apache.cxf.jaxb.JAXBEncoderDecoder.unmarshall(JAXBEncoderDecoder.java:795)
          ... 23 more
  Caused by: com.ctc.wstx.exc.WstxUnexpectedCharException: Illegal character (NULL, unicode 0) encountered: not valid in any content
   at [row,col {unknown-source}]: [2,1]
          at com.ctc.wstx.sr.StreamScanner.constructNullCharException(StreamScanner.java:630)
          at com.ctc.wstx.sr.StreamScanner.throwInvalidSpace(StreamScanner.java:660)
          at com.ctc.wstx.sr.BasicStreamReader.readTextPrimary(BasicStreamReader.java:4576)
          at com.ctc.wstx.sr.BasicStreamReader.nextFromTree(BasicStreamReader.java:2879)
          at com.ctc.wstx.sr.BasicStreamReader.next(BasicStreamReader.java:1072)
          at com.sun.xml.bind.v2.runtime.unmarshaller.StAXStreamConnector.bridge(StAXStreamConnector.java:196)
          at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal0(UnmarshallerImpl.java:370)
          ... 29 more
  </code></pre>