Package org.apache.axiom.soap

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


        ByteArrayOutputStream byteOutStr = new ByteArrayOutputStream();

        OMOutputFormat outputFormat = new OMOutputFormat();
        outputFormat.setCharSetEncoding(UTF_16);
        envelope.serialize(byteOutStr, outputFormat);

        ByteArrayInputStream byteInStr = new ByteArrayInputStream(byteOutStr.toByteArray());

        SOAPModelBuilder builder = OMXMLBuilderFactory.createSOAPModelBuilder(
                byteInStr, UTF_16);
View Full Code Here


   
    // Serialize
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    OMOutputFormat omFormat = new OMOutputFormat();
    omFormat.setXmlStreamWriterFilter(new XMLStreamWriterRemoveIllegalChars());
    env1.serialize(baos, omFormat);
   
    String xmlText = baos.toString();
    System.out.println("Serialized Text = " + xmlText);
   
    ByteArrayInputStream bais = new ByteArrayInputStream(xmlText.getBytes("UTF-8"));
View Full Code Here

        assertEquals("iso-8859-1", builder.getDocument().getXMLStreamReader().getCharacterEncodingScheme());

        ByteArrayOutputStream byteOutStr = new ByteArrayOutputStream();
        OMOutputFormat outputFormat = new OMOutputFormat();
        outputFormat.setCharSetEncoding("iso-8859-1");
        envelope.serialize(byteOutStr, outputFormat);

        assertXMLEqual(new InputStreamReader(new ByteArrayInputStream(xml.getBytes("iso-8859-1")),"iso-8859-1"),
                new InputStreamReader(new ByteArrayInputStream(byteOutStr.toByteArray()),"iso-8859-1"));
       
        builder.close();
View Full Code Here

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

        SOAPEnvelope env = (SOAPEnvelope) builderOne.getDocumentElement();
        env.serialize(writer);
        writer.flush();
        assertTrue(new String(byteArrayOutputStream.toByteArray()).length() > 1);
    }

    /** Will just do a probe test to check serialize with caching off works without any exception */
 
View Full Code Here

    }

    public void testStaxBuilder() throws Exception {
        SOAPEnvelope envelope = (SOAPEnvelope) builder.getDocumentElement();
        assertNotNull(envelope);
        envelope.serialize(new FileOutputStream(tempFile));


    }

    protected void tearDown() throws Exception {
View Full Code Here

        body.serialize(writer);
    }

    public void testCompleteElement() throws Exception {
        SOAPEnvelope env = (SOAPEnvelope) builder.getDocumentElement();
        env.serialize(writer);
    }

    public void testDualNamespaces1() throws Exception {
        OMFactory factory = OMAbstractFactory.getOMFactory();
        OMNamespace ns1 = factory.createOMNamespace("bar", "x");
View Full Code Here

        OMSourcedElement element = factory.createOMElement(new JAXBOMDataSource(context, orgObject));
        orgEnvelope.getBody().addChild(element);
       
        // Serialize the message
        ByteArrayOutputStream out = new ByteArrayOutputStream();
        orgEnvelope.serialize(out);
        assertFalse(element.isExpanded());
       
        SOAPEnvelope envelope = OMXMLBuilderFactory.createSOAPModelBuilder(
                new ByteArrayInputStream(out.toByteArray()), null).getSOAPEnvelope();
        DocumentBean object = (DocumentBean)context.createUnmarshaller().unmarshal(
View Full Code Here

       
        // Serialize the message
        OMOutputFormat format = new OMOutputFormat();
        format.setDoOptimize(true);
        ByteArrayOutputStream out = new ByteArrayOutputStream();
        orgEnvelope.serialize(out, format);
        assertFalse(element.isExpanded());
       
        // Parse the serialized message
        Attachments att = new Attachments(new ByteArrayInputStream(out.toByteArray()), format.getContentType());
        assertEquals(2, att.getAllContentIDs().length);
View Full Code Here

    private void writeSwAMessage(OutputStream outputStream, OMOutputFormat format)
            throws XMLStreamException, UnsupportedEncodingException {
        StringWriter writer = new StringWriter();
        SOAPEnvelope envelope = axiomMessage.getSOAPEnvelope();
        if (payloadCaching) {
            envelope.serialize(writer, format);
        }
        else {
            envelope.serializeAndConsume(writer, format);
        }
View Full Code Here

          StAXSOAPModelBuilder stAXSOAPModelBuilder =
                    new StAXSOAPModelBuilder(inputFactory.createXMLStreamReader(bis), null);
            SOAPEnvelope envelope = stAXSOAPModelBuilder.getSOAPEnvelope();

            // Necessary to build a correct Axiom tree, see SWS-483
            envelope.serialize(new NullOutputStream());

            return envelope;
        }
        catch (Exception ex) {
            IllegalArgumentException iaex =
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.