Package com.sun.xml.stream.buffer

Examples of com.sun.xml.stream.buffer.XMLStreamBufferResult


    }

    public void testWSDLNamespaces() throws Exception {
        URL wsdl = this.getClass().getClassLoader().getResource("data/header.wsdl");
        System.out.println("WSDL="+wsdl);
        XMLStreamBufferResult xsbr = new XMLStreamBufferResult();
        SAXParserFactory spf = SAXParserFactory.newInstance();
        spf.setNamespaceAware(true);
        XMLReader xmlReader = spf.newSAXParser().getXMLReader();
        TransformerHandler transformerHandler = ((SAXTransformerFactory) TransformerFactory.newInstance()).newTransformerHandler();
        transformerHandler.setResult(xsbr);
        xmlReader.setContentHandler(transformerHandler);
        xmlReader.parse(wsdl.toExternalForm());

        XMLStreamBuffer xsb = xsbr.getXMLStreamBuffer();

        XMLStreamReader rdr = XMLInputFactory.newInstance().createXMLStreamReader(wsdl.openStream());
        XMLStreamReader xsbrdr = xsb.readAsXMLStreamReader();
        compareReaderQNames(rdr, xsbrdr, "wsdl", "soap", "xsd");
    }
View Full Code Here


    // FAILS on JDK 1.6.0_04(possibly on all JDK6) but passes on JDK5
    public void testWSDLNamespaces2() throws Exception {
        URL wsdl = this.getClass().getClassLoader().getResource("data/header.wsdl");
        System.out.println("WSDL="+wsdl);
        StreamSource source = new StreamSource(wsdl.openStream());
        XMLStreamBufferResult xsbr = new XMLStreamBufferResult();
        TransformerFactory.newInstance().newTransformer().transform(source, xsbr);
        XMLStreamBuffer xsb = xsbr.getXMLStreamBuffer();

        XMLStreamReader rdr = XMLInputFactory.newInstance().createXMLStreamReader(wsdl.openStream());
        XMLStreamReader xsbrdr = xsb.readAsXMLStreamReader();
        compareReaderQNames(rdr, xsbrdr, "wsdl", "soap", "xsd");
    }
View Full Code Here

    @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;
        }
View Full Code Here

     * marshalls the BST element into the XMLStreamBuffer
     * @return XMLStreamReader
     * @throws javax.xml.stream.XMLStreamException
     */
    public XMLStreamReader readHeader() throws XMLStreamException {
        XMLStreamBufferResult xbr = new XMLStreamBufferResult();
        JAXBElement<BinarySecurityTokenType> bstElem =
                new ObjectFactory().createBinarySecurityToken(bst);
        try{
            getMarshaller().marshal(bstElem, xbr);
        }catch(JAXBException je){
            //log here
            throw new XMLStreamException(je);
        }
        return xbr.getXMLStreamBuffer().readAsXMLStreamReader();
    }
View Full Code Here

    private final Map<String, SDDocumentSource> wsdls = new HashMap<String, SDDocumentSource>();

    public MexEntityResolver(List<? extends Source> wsdls) throws IOException {
        Transformer transformer = XmlUtil.newTransformer();
        for (Source source : wsdls) {
            XMLStreamBufferResult xsbr = new XMLStreamBufferResult();
            try {
                transformer.transform(source, xsbr);
            } catch (TransformerException e) {
                throw new WebServiceException(e);
            }
            String systemId = source.getSystemId();

            //TODO: can we do anything if the given mex Source has no systemId?
            if(systemId != null){
                SDDocumentSource doc = SDDocumentSource.create(JAXWSUtils.getFileOrURL(systemId), xsbr.getXMLStreamBuffer());
                this.wsdls.put(systemId, doc);
            }
        }
    }
View Full Code Here

        URL url = createURL(filename);
        MutableXMLStreamBuffer xsb = new MutableXMLStreamBuffer();
        xsb.setSystemId(url.toExternalForm());
        concreteWsdlSource = SDDocumentSource.create(url,xsb);
        newDocs.add(concreteWsdlSource);
        XMLStreamBufferResult r = new XMLStreamBufferResult(xsb);
        r.setSystemId(filename);
        return r;
    }
View Full Code Here

        URL url = createURL(filename.value);
        MutableXMLStreamBuffer xsb = new MutableXMLStreamBuffer();
        xsb.setSystemId(url.toExternalForm());
        SDDocumentSource abstractWsdlSource = SDDocumentSource.create(url,xsb);
        newDocs.add(abstractWsdlSource);
        XMLStreamBufferResult r = new XMLStreamBufferResult(xsb);
        r.setSystemId(filename.value);
        return r;
    }
View Full Code Here

        MutableXMLStreamBuffer xsb = new MutableXMLStreamBuffer();
        xsb.setSystemId(url.toExternalForm());
        SDDocumentSource sd = SDDocumentSource.create(url,xsb);
        newDocs.add(sd);

        XMLStreamBufferResult r = new XMLStreamBufferResult(xsb);
        r.setSystemId(filename.value);
        return r;
    }
View Full Code Here

    }

    public XMLStreamReader readPayload() throws XMLStreamException {
       try {
            if(infoset==null) {
                XMLStreamBufferResult sbr = new XMLStreamBufferResult();
                bridge.marshal(jaxbObject,sbr);
                infoset = sbr.getXMLStreamBuffer();
            }
            XMLStreamReader reader = infoset.readAsXMLStreamReader();
            if(reader.getEventType()== START_DOCUMENT)
                XMLStreamReaderUtil.nextElementContent(reader);
            return reader;
View Full Code Here

        List<SDDocumentSource> r = new ArrayList<SDDocumentSource>();

        if (metadata != null) {
            for (Source source : metadata) {
                try {
                    XMLStreamBufferResult xsbr = XmlUtil.identityTransform(source, new XMLStreamBufferResult());
                    String systemId = source.getSystemId();

                    r.add(SDDocumentSource.create(new URL(systemId), xsbr.getXMLStreamBuffer()));
                } catch (TransformerException te) {
                    throw new ServerRtException("server.rt.err", te);
                } catch (IOException te) {
                    throw new ServerRtException("server.rt.err", te);
                } catch (SAXException e) {
View Full Code Here

TOP

Related Classes of com.sun.xml.stream.buffer.XMLStreamBufferResult

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.