Hi, I have the same problem. Can you elaborate on the "...", ie how to extract the XML string from the request? I've tried a few different methods without success. I'm running Tomcat 4.1.24-LE-jdk14 on Solaris. I have a servlet that clients post XML to. One client uses XMLHTTP object to do the post, and that's the one that's causing problems. All other clients are fine. I'd like to post the two approaches I've tried to resolve this, then maybe someone can tell me what I'm doing wrong or how to work around this?
First, the simple, obvious approach - simply build a document from the input stream: DocumentBuilder builder = DocumentBuilderFactory.newInstance().newDocumentBuilder(); Document document = builder.parse(req.getInputStream()); When I try this, I get "org.xml.sax.SAXParseException: Content is not allowed in prolog". Second, I tried to forcibly retrieve characters from the input stream, one by one. String xmlDocString = getXMLString((InputStream) req.getInputStream()); Document document = builder.parse(new StringBufferInputStream(xmlDocString)); Note: the getXMLString() function is not very interesting... simply has a loop as follows: while( (c=xmlInputStream.read()) > 0 ) When I try this, I get the same error, however I don't get an empty string - xmlDocString has what looks like a URL encoded and truncated version of the original string. I would really appreciate any insight as to why this happens, even if a solution is not forthcoming. Thanks! John Blackmore --------------------------------------------------------- Howdy, You need to read the whole request into a String. Then, since you want a DOM document, use a DOM document builder to get it, e.g. String xmlInput = ... Reader reader = new Stringeader(xmlInput); InputSource inputSource = new InputSource(reader); DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); DocumentBuilder db = dbf.newDocumentBuilder(); Document doc = db.parse(inputSource) (The above are mixed imports from java.io, javax.xml.parsers, org.w3c.dom). Yoav Shapira Millennium ChemInformatics >-----Original Message----- >From: Jose Alanya [mailto:[EMAIL PROTECTED] >Sent: Thursday, October 09, 2003 6:21 PM >To: [EMAIL PROTECTED] >Subject: I post a text XML with Microsoft.XMLHTTP to servlet > >Hi, > >I post a text XML with Microsoft.XMLHTTP to servlet, >As I can recover the value of object request from of servlet >This can : >something like : Document oDocument = xml.paser(objrequest) > >Not getparameter, not getquerystring > >Please help me! >Thanks, > >best regards, >Jose Alanya >From, Lima Peru ************************************************************************** This e-mail and any files transmitted with it may contain privileged or confidential information. It is solely for use by the individual for whom it is intended, even if addressed incorrectly. If you received this e-mail in error, please notify the sender; do not disclose, copy, distribute, or take any action in reliance on the contents of this information; and delete it from your system. Any other use of this e-mail is prohibited. Thank you for your compliance. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]