Package org.apache.axiom.soap

Examples of org.apache.axiom.soap.SOAPEnvelope.serializeAndConsume()


        OMElement payload = soapFactory.createOMElement(new DummySource(), "dummy", ns);
        payload.setNamespace(ns); // This line will cause NoSuchElementException
        body.addChild(payload);
        payload.getBuilder().setCache(false); // Or This line will cause NoSuchElementException
        StringWriter writer = new StringWriter();
        envelope.serializeAndConsume(writer);
//        System.out.println(writer);
    }
   
    private static class DummySource implements OMDataSource {
        private XMLStreamReader reader;
View Full Code Here


    public void testSerilizationWithCacheOff() throws Exception {
        writer = StAXUtils.createXMLStreamWriter(new ByteArrayOutputStream(),
                OMConstants.DEFAULT_CHAR_SET_ENCODING);

        SOAPEnvelope env = (SOAPEnvelope) builderOne.getDocumentElement();
        env.serializeAndConsume(writer);
        writer.flush();
    }
}
View Full Code Here

        ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
        writer = StAXUtils.createXMLStreamWriter(byteArrayOutputStream,
                OMConstants.DEFAULT_CHAR_SET_ENCODING);

        SOAPEnvelope env = (SOAPEnvelope) builder.getDocumentElement();
        env.serializeAndConsume(writer);
        writer.flush();

        String outputString = new String(byteArrayOutputStream.toByteArray());
        assertTrue(outputString != null && !"".equals(outputString) && outputString.length() > 1);
View Full Code Here

        StringWriter stringWriter = new StringWriter();

        //now we should not be able to serilaize anything ! this should throw
        //an error
        try {
            env.serializeAndConsume(writer);
            fail();
        } catch (UnsupportedOperationException e) {
            e.printStackTrace(new PrintWriter(stringWriter, true));
            assertTrue(stringWriter.toString()
                                   .indexOf("The parser is already consumed!") > -1);
View Full Code Here

        SOAPEnvelope envelope = axiomMessage.getSOAPEnvelope();
        if (payloadCaching) {
            envelope.serialize(writer, format);
        }
        else {
            envelope.serializeAndConsume(writer, format);
        }

      try {
        OMMultipartWriter mpw = new OMMultipartWriter(outputStream, format);
View Full Code Here

                factory.createOMElement("AuthnContextClassRef", saml,
                                        authnContext);
            authnContextClassRef.setText("urn:oasis:names:tc:SAML:2.0:ac:classes:PasswordProtectedTransport");
        }

        soapEnvelope.serializeAndConsume(writer);
    }

    /**
     * Gets the user's Distinguished Name (DN)
     *
 
View Full Code Here

                factory.createOMElement("Action", saml, authzDecisionStatement);
            action.addAttribute("Namespace", query.getActionNamespace(), null);
            action.setText(query.getAction());
        }

        soapEnvelope.serializeAndConsume(writer);
    }

    /**
     * Checks the Object is not null
     *
 
View Full Code Here

        writer =
                XMLOutputFactory.newInstance().
                        createXMLStreamWriter(byteArrayOutputStream);

        SOAPEnvelope env = (SOAPEnvelope) soapBuilder.getDocumentElement();
        env.serializeAndConsume(writer);
        writer.flush();

        String outputString = new String(byteArrayOutputStream.toByteArray());
        assertTrue(outputString != null && !"".equals(outputString) && outputString.length() > 1);
View Full Code Here

        StringWriter stringWriter = new StringWriter();

        //now we should not be able to serilaize anything ! this should throw
        //an error
        try {
            env.serializeAndConsume(writer);
            fail();
        } catch (XMLStreamException e) {
            e.printStackTrace(new PrintWriter(stringWriter, true));
            assertTrue(stringWriter.toString().indexOf("problem accessing the parser. Parser already accessed!") > -1);
        } catch (Exception e) {
View Full Code Here

        OMXMLParserWrapper builder = OMXMLBuilderFactory.createStAXSOAPModelBuilder(
                OMAbstractFactory.getSOAP11Factory(),
                reader);

        SOAPEnvelope env = (SOAPEnvelope) builder.getDocumentElement();
        env.serializeAndConsume(writer);
        writer.flush();

        //now we should not be able to serilaize anything ! this should throw
        //an error
        try {
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.