public static SOAPMessage DocumentToSOAPMessage(Document doc) throws SOAPBindingException {
  SOAPMessage msg=null;
  try {
    MimeHeaders mimeHeaders=new MimeHeaders();
    mimeHeaders.addHeader("Content-Type","text/xml");
    String xmlstr=XMLUtils.print(doc);
    if (debug.messageEnabled()) {
      debug.message("Utils.DocumentToSOAPMessage: xmlstr = " + xmlstr);
    }
    msg=messageFactory.createMessage(mimeHeaders,new ByteArrayInputStream(xmlstr.getBytes(SOAPBindingConstants.DEFAULT_ENCODING)));
  }
 catch (  Exception e) {
    debug.error("Utils.DocumentToSOAPMessage",e);
    throw new SOAPBindingException(e.getMessage());
  }
  return msg;
}

public static SOAPMessage DocumentToSOAPMessage ( Document doc ) throws SOAPBindingException { SOAPMessage msg = null ; try { MimeHeaders mimeHeaders = new MimeHeaders ( ) ; mimeHeaders . addHeader ( "Content-Type" , "text/xml" ) ; String xmlstr = XMLUtils . print ( doc ) ; if ( debug . messageEnabled ( ) ) { debug . message ( "Utils.DocumentToSOAPMessage: xmlstr = " + xmlstr ) ; } msg = messageFactory . createMessage ( mimeHeaders , new ByteArrayInputStream ( xmlstr . getBytes ( SOAPBindingConstants . DEFAULT_ENCODING ) ) ) ; } catch ( Exception e ) { debug . error ( "Utils.DocumentToSOAPMessage" , e ) ; throw new SOAPBindingException ( e . getMessage ( ) ) ; } return msg ; }
converts document to soapmessage
