title: How to create and send apache cxf SoapMessage with cxf Messgae?
body: <p>I'm using IntellijIDEA and I have project for testing SOAP WS. I have xml and msg file for sending. How can I cast this file into cxf Message and cxf SoapMessage for sending? This is my method, which return SoapMessage:</p>
  
  <pre><code>public SoapMessage getMessage(File file) throws Exception{
   Message msg;
   msg.setContent(File.class, file);
   SoapMessage message = new SoapMessage(msg);
   return message;
  }
  </code></pre>
  
  <p>But if I try call this method, I see this:</p>
  
  <blockquote>
    <p>java.lang.NullPointerException</p>
  </blockquote>
  
  <p>I try send this msg:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
  schemaLocation="http://schemas.xmlsoap.org/soap/envelope/"&gt;
  &lt;soapenv:Header/&gt;
  &lt;soapenv:Body&gt;
      &lt;Test&gt;
        &lt;msg&gt;Test&lt;/msg&gt;
      &lt;/Test&gt;
  &lt;/soapenv:Body&gt;
  &lt;/soapenv:Envelope&gt;
  </code></pre>
  
  <p>UPD:
  What need to msg initiallistion?</p>
  
  <pre><code>Message msg = new Message(){...}?
  </code></pre>
  
  <p>It use for cast my *.msg file into SoapMessage and send it into SOAP WS</p>