Search in sources :

Example 6 with XMLStreamBufferResult

use of com.sun.xml.stream.buffer.XMLStreamBufferResult in project metro-jax-ws by eclipse-ee4j.

the class JAXBMessage method readPayload.

@Override
public XMLStreamReader readPayload() throws XMLStreamException {
    try {
        if (infoset == null) {
            if (rawContext != null) {
                XMLStreamBufferResult sbr = new XMLStreamBufferResult();
                Marshaller m = rawContext.createMarshaller();
                m.setProperty("jaxb.fragment", Boolean.TRUE);
                m.marshal(jaxbObject, sbr);
                infoset = sbr.getXMLStreamBuffer();
            } else {
                MutableXMLStreamBuffer buffer = new MutableXMLStreamBuffer();
                writePayloadTo(buffer.createFromXMLStreamWriter());
                infoset = buffer;
            }
        }
        XMLStreamReader reader = infoset.readAsXMLStreamReader();
        if (reader.getEventType() == XMLStreamConstants.START_DOCUMENT)
            XMLStreamReaderUtil.nextElementContent(reader);
        return reader;
    } catch (JAXBException e) {
        // bug 6449684, spec 4.3.4
        throw new WebServiceException(e);
    }
}
Also used : Marshaller(jakarta.xml.bind.Marshaller) AttachmentMarshaller(jakarta.xml.bind.attachment.AttachmentMarshaller) MutableXMLStreamBuffer(com.sun.xml.stream.buffer.MutableXMLStreamBuffer) XMLStreamReader(javax.xml.stream.XMLStreamReader) WebServiceException(jakarta.xml.ws.WebServiceException) JAXBException(jakarta.xml.bind.JAXBException) XMLStreamBufferResult(com.sun.xml.stream.buffer.XMLStreamBufferResult)

Aggregations

XMLStreamBufferResult (com.sun.xml.stream.buffer.XMLStreamBufferResult)6 MutableXMLStreamBuffer (com.sun.xml.stream.buffer.MutableXMLStreamBuffer)4 URL (java.net.URL)4 SDDocumentSource (com.sun.xml.ws.api.server.SDDocumentSource)2 Marshaller (jakarta.xml.bind.Marshaller)2 XMLStreamReader (javax.xml.stream.XMLStreamReader)2 XMLStreamBuffer (com.sun.xml.stream.buffer.XMLStreamBuffer)1 ServerRtException (com.sun.xml.ws.server.ServerRtException)1 JAXBException (jakarta.xml.bind.JAXBException)1 AttachmentMarshaller (jakarta.xml.bind.attachment.AttachmentMarshaller)1 SOAPFault (jakarta.xml.soap.SOAPFault)1 WebServiceException (jakarta.xml.ws.WebServiceException)1 IOException (java.io.IOException)1 ArrayList (java.util.ArrayList)1 ParserConfigurationException (javax.xml.parsers.ParserConfigurationException)1 Source (javax.xml.transform.Source)1 TransformerException (javax.xml.transform.TransformerException)1 JAXBRIContext (org.glassfish.jaxb.runtime.api.JAXBRIContext)1 SAXException (org.xml.sax.SAXException)1