RE: I post a text XML with Microsoft.XMLHTTP to servlet
Howdy, You should be able to test this using either MockObjects or Cactus, before sending it to your clients ;) Yoav Shapira Millennium ChemInformatics -Original Message- From: Blackmore, John [mailto:[EMAIL PROTECTED] Sent: Tuesday, October 14, 2003 2:01 PM To: 'Tomcat Users List' Subject: RE: I post a text XML with Microsoft.XMLHTTP to servlet Sorry, I was mistaken - what little content was there was actually another form element which didn't belong. Looks like my XMLHTTP test app was the problem. I think I have it working with my second approach below, however I won't know for sure until the client tests it. Needless to say, they expect it to work right the first time (sigh). Thanks for the quick responses! John -Original Message- From: Shapira, Yoav [mailto:[EMAIL PROTECTED] Sent: Tuesday, October 14, 2003 9:24 AM To: Tomcat Users List Subject: RE: I post a text XML with Microsoft.XMLHTTP to servlet Howdy, 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. This is the approach I had in mind. Then URL-decode it (URLDecoder.decode(...)). Why is it truncated? Yoav Shapira *** *** 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] This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify the sender. Thank you. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: I post a text XML with Microsoft.XMLHTTP to servlet
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]
RE: I post a text XML with Microsoft.XMLHTTP to servlet
Howdy, 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. This is the approach I had in mind. Then URL-decode it (URLDecoder.decode(...)). Why is it truncated? Yoav Shapira This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify the sender. Thank you. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: I post a text XML with Microsoft.XMLHTTP to servlet
Try to call your XML in the internet explorer and see if that xml have no errors.. It seems like the xml isn't well formed... Sincerely Erlis Vidal Santos -Original Message- From: Blackmore, John [mailto:[EMAIL PROTECTED] Sent: Tuesday, October 14, 2003 9:22 AM To: '[EMAIL PROTECTED]' Subject: Re: I post a text XML with Microsoft.XMLHTTP to servlet 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] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: I post a text XML with Microsoft.XMLHTTP to servlet
Sorry, I was mistaken - what little content was there was actually another form element which didn't belong. Looks like my XMLHTTP test app was the problem. I think I have it working with my second approach below, however I won't know for sure until the client tests it. Needless to say, they expect it to work right the first time (sigh). Thanks for the quick responses! John -Original Message- From: Shapira, Yoav [mailto:[EMAIL PROTECTED] Sent: Tuesday, October 14, 2003 9:24 AM To: Tomcat Users List Subject: RE: I post a text XML with Microsoft.XMLHTTP to servlet Howdy, 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. This is the approach I had in mind. Then URL-decode it (URLDecoder.decode(...)). Why is it truncated? Yoav Shapira ** 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]
RE: I post a text XML with Microsoft.XMLHTTP to servlet
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, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify the sender. Thank you. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]