Package org.apache.axiom.soap

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


        writer.flush();

        //now we should not be able to serilaize anything ! this should throw
        //an error
        try {
           env.serializeAndConsume(writer);
           fail();
        } catch (XMLStreamException e) {
           assertTrue(true);
        } catch (Exception e) {
           assertTrue(true);
View Full Code Here


    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

        OMOutputFormat format = new OMOutputFormat();
        format.setDoOptimize(true);
        format.setSOAP11(true);
              
        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        env.serializeAndConsume(baos, format);

        TestLogger.logger.debug("==================================");
        TestLogger.logger.debug(baos.toString());
        TestLogger.logger.debug("==================================");
    }
View Full Code Here

        OMOutputFormat format = new OMOutputFormat();
        format.setDoOptimize(true);
        format.setSOAP11(true);
              
        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        soapOM.serializeAndConsume(baos, format);

        TestLogger.logger.debug("==================================");
        TestLogger.logger.debug(baos.toString());
        TestLogger.logger.debug("==================================");
    }
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

        // TODO If this changes, please add more assertions here.
       
        // 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

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.