Thank you all.
This is what I ended up doing. Similar to your suggestions.
// write the SOAPMessage to an OutputStream, convert that to
// a string and close the OutputStream
ByteArrayOutputStream baos = new ByteArrayOutputStream();
SOAPMessage.writeTo(baos);
String strSOAPMsg = baos.toString();
baos.close();
// log the raw SOAPMessage string
logger.error(strSOAPMsg);
// now build an InputSource to send to the SAXParser
// from the strSOAPMsg
StringReader chrStream = new StringReader(strSOAPMsg);
InputSource is = new InputSource(chrStream);
// this is the code to call the SAXParser (goes with the
// SAXParseHandler class)
SAXParserFactory spf = SAXParserFactory.newInstance();
SAXParser parser = spf.newSAXParser();
parser.parse(is, new SAXParseHandler());
-----Original Message-----
From: Attila Szegedi [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, March 06, 2002 3:14 AM
To: [EMAIL PROTECTED]
Subject: Re: OT: IOStreams
If you can use two threads, then use a combination of
java.io.PipedInputStream and java.io.PipedOutputStream - one thread writes
to the pipe, the other reads from it.
If you must work on a single thread, then you have no choice but to first
write all content to a stream of your choice (ByteArrayOutputStream if you
it has sustainable memory load, FileOutputStream to a temporary file if it
is larger than what your app could bear in RAM), then read it back from
there (ByteArrayInputStream or FileInputStream).
--
Attila Szegedi
home: http://www.szegedi.org
----- Original Message -----
From: "Dahnke, Eric" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: 2002. m�rcius 6. 0:28
Subject: OT: IOStreams
> Would someone be so kind as to point me in the right direction here.
>
> I need an OutputStream to InputStream converter (os -> is).
>
> SOAPmessage.writeTo(java.io.OutputStream os);
> SAXParser.parse(java.io.InputStream is, new SAXParseHandler());
>
> Is there such a utility or do I need to do it manually write two loops,
one
> writing the stream out and one reading the stream in?
>
>
> TIA
>
>
___________________________________________________________________________
> To unsubscribe, send email to [EMAIL PROTECTED] and include in the
body
> of the message "signoff SERVLET-INTEREST".
>
> Archives: http://archives.java.sun.com/archives/servlet-interest.html
> Resources: http://java.sun.com/products/servlet/external-resources.html
> LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
>
>
>
>
___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".
Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".
Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html