Peter,
     We're doing exactly what you're trying to do...I would recommend not
building a string and converting to xml...here is a test method that uses
the apache utils package for writing out a dom document to a  string....

protected static String getSourceDocument(String aURL) throws Exception {
     //Read in an XML file that is hardcoded for testing purposes
     DOMParser myparser = new DOMParser();
     //myparser.parse(new InputSource
("file:///d:/somedirectory/Version1.0/receiveinventory.XML"));
     myparser.parse(new InputSource(aURL));
     Document doc = myparser.getDocument();
     Element root = doc.getDocumentElement();

     //Strip out the carriage reutrns and line feeds (SOAP does NOT like
them)
     String lsdoc = DOMWriter.nodeToString(root);
     char lsfind = '\r';
     char lsreplace = '\u0020';
     String lsdoc2 = lsdoc.replace(lsfind,lsreplace);
     lsfind = '\n';
     lsdoc2 = lsdoc2.replace(lsfind,lsreplace);

     //WRAP the string in a CDATA section since SOAP does NOT like strings
with tags...
     String ls_read = new String("<![CDATA["+lsdoc2+"]]>");
     return ls_read;
}

Reply via email to