I recently did this by parsing the SOAP Message (via JAXM) with SAX. My
parser class happily takes an XML file or any kind of input stream, so I
just wrote the SOAP message out to a OS (did a OS -> IS conversion as
follows).


// write the SOAPMessage to an OutputStream, convert that to
// a string and close the OutputStream
ByteArrayOutputStream baos = new ByteArrayOutputStream();
message.writeTo(baos);
String strSOAPMsg = baos.toString();
baos.close();

// 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());





HTH




-----Original Message-----
From: Paul Brown [mailto:[EMAIL PROTECTED]]
Sent: Monday, March 18, 2002 1:03 PM
To: Tomcat Users List
Subject: JAXMServlet + SOAP


Hi

I've got a Servlet which extends JAXMServlet and i'm trying to
write some code to process received messages.


I am following the Sun example
http://java.sun.com/xml/jaxm-0_9_2-prd-spec.pdf


To get a DOM from a SOAPMessage you need to do this apparently:

     DOMSource domSrc = (DOMSource)
soapEnvelope.getContentAs(DOMSource.FEATURE );

However, the "getContentAs" method does not exist on the SOAPEnvelope.


Have any of you come across this?

Has anybody got a code sample that shows how to get a DOM from one of
the SOAP
objects in the JAXM api?

thanks
Paul

--
To unsubscribe:   <mailto:[EMAIL PROTECTED]>
For additional commands: <mailto:[EMAIL PROTECTED]>
Troubles with the list: <mailto:[EMAIL PROTECTED]>

Reply via email to