axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Eran Chinthaka <chinth...@opensource.lk>
Subject Re: SAX or StAX?
Date Thu, 08 Sep 2005 09:17:07 GMT

>     ----- Original Message -----
>     *From:* aii@gmx.de <mailto:aii@gmx.de>
>     *To:* axis-user@ws.apache.org <mailto:axis-user@ws.apache.org>
>     *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
>

Mime
View raw message