title: java.lang.NullPointerException in org.apache.cxf.attachment.LazyDataSource.getInputStream
body: <p>I am using cxf 2.7.7  and using MTOM with https ... and it is working ok with cxf java client.
  However when I send a message though SOAP UI client,  and at the server side (in my endpoint implementation class) I try to access any of the methods of the Datahandler object  (please see abridged code below) then I get java.lang.NullPointerException in org.apache.cxf.attachment.LazyDataSource. Please note that call to any  .getXXX method gives exception (these calls translate to corresponding call to LazyDataSource.getXXX methods ... and looks like LazyDataSource is null) 
  This does NOT happen when I send requests through java client. Happens only when I use SOAPUI for request 
      @WebService(targetNamespace = "<a href="http://webservice.dcca.dell.com" rel="nofollow">http://webservice.dcca.dell.com</a>", 
  portName = "ObjectMTOMService", serviceName = "ObjectMTOMServiceService") 
      public class ObjectMTOMServiceImpl implements ObjectMTOMService { </p>
  
  <pre><code>@Resource 
  WebServiceContext wsContext; 
  
  public ObjectStoreResp uploadObject(ObjectStoreReq objectReqParam) { 
  
      DataHandler objHandler = objectReqParam.getObjData(); 
  
      try { 
  
                      if (objHandler != null) 
                      { 
  
                      String objName=objHandler.getName(); 
  
                      String contentType=objHandler.getContentType(); 
  
                      InputStream iStream= objHandler.getDataSource().getInputStream(); 
  
                       } 
            catch (Exception e) { 
                      e.printStackTrace(); 
                      respParam.setRespCode(-1); 
                      return (respParam); 
              } 
  } 
  </code></pre>
  
  <p>The exception I see is as follows </p>
  
  <pre><code>java.lang.NullPointerException 
      at org.apache.cxf.attachment.LazyDataSource.getName(LazyDataSource.java:73) 
      at javax.activation.DataHandler.getName(DataHandler.java:191) 
      at com.dell.dcca.webservice.objectmtomservice.ObjectMTOMServiceImpl.uploadObject(ObjectMTOMServiceImpl.java:98) 
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) 
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 
  
     ........  &lt;&lt;&lt; removed lot of stack trace for brevity &gt;&gt;&gt; 
  
      at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1597) 
      at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1555) 
      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110) 
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603) 
      at java.lang.Thread.run(Thread.java:722) 
  java.lang.NullPointerException 
  </code></pre>
  
  <p>The message that SOAPUI  sends is as follows &lt;&lt; I have approximated this -- copying and pasting from SOAPUI log >> </p>
  
  <pre><code>POST https://160.110.73.35:8443/ObjectMTOMService/services/ObjectMTOMService HTTP/1.1 
  Accept-Encoding: gzip,deflate 
  Content-Type: multipart/related; type="application/xop+xml"; start="&lt;rootpart@soapui.org&gt;";     start-info="text/xml"; boundary="----=_Part_13_756617.1389959552144" 
  SOAPAction: "http://InteropBaseAddress/interop/header" 
  MIME-Version: 1.0 
  Content-Length: 5432 
  Host: 160.110.73.35:8443 
  Connection: Keep-Alive 
  User-Agent: Apache-HttpClient/4.1.1 (java 1.5) 
  ------=_Part_13_756617.1389959552144" 
  "Content-Type: application/octet-stream; name=InfantHealthcare.jpg" 
  Content-Transfer-Encoding: binary 
  Content-ID: &lt;images.jpg&gt;
  Content-Disposition: attachment; name="images.jpg"; filename="InfantHealthcare.jpg 
  &lt;&lt; file contents ... &gt;&gt; 
  </code></pre>
  
  <p>Any inputs welcome.
  If anyone has tried MTOM with SOAPui client and Axis 2.7.X onwards combination, let me know </p>
  
  <p>Thanks a ton for your help </p>
  
  <p>Yogesh</p>