private void sendResponse(Document doc,MessageFactory messageFactory,String contentType,HttpServletResponse res) throws IOException, SOAPException {
  SOAPMessage reply=messageFactory.createMessage();
  SOAPHeader header=reply.getSOAPHeader();
  header.detachNode();
  SOAPBody replyBody=reply.getSOAPBody();
  res.setHeader("Content-Type",contentType);
  replyBody.addDocument(doc);
  reply.saveChanges();
  OutputStream os=res.getOutputStream();
  reply.writeTo(os);
  os.flush();
}

private void sendResponse ( Document doc , MessageFactory messageFactory , String contentType , HttpServletResponse res ) throws IOException , SOAPException { SOAPMessage reply = messageFactory . createMessage ( ) ; SOAPHeader header = reply . getSOAPHeader ( ) ; header . detachNode ( ) ; SOAPBody replyBody = reply . getSOAPBody ( ) ; res . setHeader ( "Content-Type" , contentType ) ; replyBody . addDocument ( doc ) ; reply . saveChanges ( ) ; OutputStream os = res . getOutputStream ( ) ; reply . writeTo ( os ) ; os . flush ( ) ; }
send a response back to the client . this could be either a soap fault or a correct dsml response .
