Package org.apache.axiom.soap

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


    StAXSOAPModelBuilder sob = new StAXSOAPModelBuilder(parser, null);
    SOAPEnvelope se = (SOAPEnvelope)sob.getDocumentElement();
    SOAPHeader sh = se.getHeader();
        sh.build();
    StringWriter sw = new StringWriter();
    se.serializeAndConsume(sw);

    checkBodyExists(sw.toString());
  }

    public void testBodyPreservedSerializeAndConsumeAsXML() throws Exception{
View Full Code Here


    XMLStreamReader parser = StAXUtils.createXMLStreamReader(new StringReader(testMessage));
    StAXSOAPModelBuilder sob = new StAXSOAPModelBuilder(parser, null);
    SOAPEnvelope se = (SOAPEnvelope)sob.getDocumentElement();

    StringWriter sw = new StringWriter();
    se.serializeAndConsume(sw);

    checkBodyExists(sw.toString());
  }

  public void testBodyPreservedSerializeAndConsumeTouchesBody() throws Exception{
View Full Code Here

    SOAPHeader sh = se.getHeader();
    Iterator iter = sh.getChildElements();
    while(iter.hasNext())iter.next();
    se.getBody();
    StringWriter sw = new StringWriter();
    se.serializeAndConsume(sw);

    checkBodyExists(sw.toString());
  }

  private void checkBodyExists(String str) throws Exception{
View Full Code Here

        ds = omse.getDataSource();
        assertTrue(ds instanceof JAXBBlockImpl);
       
        // Simulate transport
        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        env.serializeAndConsume(baos, new OMOutputFormat());

        // To check that the output is correct, get the String contents of the
        // reader
        String newText = baos.toString();
        System.out.println(newText);
View Full Code Here

        axisMC.setProperty("keyInteger", new Integer(5));
       
        // Simulate transport
        baos = new ByteArrayOutputStream();
        env = restoredMC.getEnvelope();
        env.serializeAndConsume(baos, new OMOutputFormat());
        String restoredText = baos.toString();
        System.out.println(restoredText);
        assertTrue(restoredText.contains(sampleJAXBText));
        assertTrue(restoredText.contains("soap"));
        assertTrue(restoredText.contains("Envelope"));
View Full Code Here

        ds = omse.getDataSource();
        assertTrue(ds instanceof JAXBDataSource);
       
        // Simulate transport
        baos = new ByteArrayOutputStream();
        env2.serializeAndConsume(baos, new OMOutputFormat());
        String restoredText = baos.toString();
        System.out.println(restoredText);
        assertTrue(restoredText.contains(sampleJAXBText));
        assertTrue(restoredText.contains("soap"));
        assertTrue(restoredText.contains("Envelope"));
View Full Code Here

        // Simulate transport
        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        OMOutputFormat outputFormat = new OMOutputFormat();
        outputFormat.setDoOptimize(true);
        outputFormat.setMimeBoundary("MIMEBoundary_Axis2Rocks");
        env.serializeAndConsume(baos, outputFormat);

        // Make sure the output is correct
        String newText = baos.toString();
        System.out.println(newText);
        assertTrue(newText.contains("soap"));
View Full Code Here

        baos = new ByteArrayOutputStream();
        env = restoredMC.getEnvelope();
        outputFormat = new OMOutputFormat();
        outputFormat.setDoOptimize(true);
        outputFormat.setMimeBoundary("MIMEBoundary_Axis2Rocks");
        env.serializeAndConsume(baos, outputFormat);
        String restoredText = baos.toString();
        System.out.println(restoredText);
        assertTrue(restoredText.contains("soap"));
        assertTrue(restoredText.contains("Envelope"));
        assertTrue(restoredText.contains("Body"));
View Full Code Here

        // Simulate transport on the copied message
        baos = new ByteArrayOutputStream();
        outputFormat = new OMOutputFormat();
        outputFormat.setDoOptimize(true);
        outputFormat.setMimeBoundary("MIMEBoundary_Axis2Rocks");
        env2.serializeAndConsume(baos, outputFormat);
        String restoredText = baos.toString();
        System.out.println(restoredText);
        assertTrue(restoredText.contains("soap"));
        assertTrue(restoredText.contains("Envelope"));
        assertTrue(restoredText.contains("Body"));
View Full Code Here

                        // the element is built. Therefore we need two different test executions.
                        if (buildSOAPPart) {
                            envelope.build();
                        }
                        // Usage of serializeAndConsume should enable streaming
                        envelope.serializeAndConsume(pipe2Out, format);
                    } finally {
                        pipe2Out.close();
                    }
                } catch (Exception ex) {
                    ex.printStackTrace();
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.