----- Original Message -----
Sent: Thursday, August 11, 2005 11:06 PM
Subject: SAX or StAX?

Hi everybody,

I’ve got an SOAP-Message stored in a byte-array data:

// copy the data (SOAP) from udp packet
byte[] data = "">new byte[packet.getLength()];
System.arraycopy(packet.getData(), packet.getOffset(), data, 0, packet.getLength());



Now I like to have the SOAP-Envelope of the SOAP-Message. Does it make more sense to use StAX or SAX for this job (I’m using Axis2)??? How would the solution (with the byte-array) be realized??

        byte[] data = "" your byte array here
        ByteArrayInputStream bais = new ByteArrayInputStream(data);
        XMLStreamReader xmlStreamReader = XMLInputFactory.newInstance().createXMLStreamReader(bais);
        StAXSOAPModelBuilder soapBuilder = new StAXSOAPModelBuilder(xmlStreamReader);
        SOAPEnvelope soapEnvelope = soapBuilder.getSOAPEnvelope();

-- Chinthaka



Thanks for your help,
Chris



Reply via email to