Package org.apache.axiom.soap

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


                format.setIgnoreXMLDeclaration(true);
            }
           
            SOAPEnvelope envelope = ((SOAPEnvelopeImpl) soapPart.getEnvelope()).getOMTarget();
            if (attachmentParts.isEmpty()) {
                envelope.serialize(out, format);
            } else {
                ContentType contentType = new ContentType(getSingleHeaderValue(HTTPConstants.HEADER_CONTENT_TYPE));
                String boundary = contentType.getParameter("boundary");
                if(isEmptyString(boundary)) {
                    boundary = UIDGenerator.generateMimeBoundary();
View Full Code Here


                //Double save the content-type in case anything is updated
                mimeHeaders.setHeader(HTTPConstants.HEADER_CONTENT_TYPE, contentType.toString());

                OMMultipartWriter mpw = new OMMultipartWriter(out, format);
                OutputStream rootPartOutputStream = mpw.writeRootPart();
                envelope.serialize(rootPartOutputStream);
                rootPartOutputStream.close();
                for (AttachmentPart ap : attachmentParts) {
                    mpw.writePart(ap.getDataHandler(), ap.getContentId());
                }
                mpw.complete();
View Full Code Here

        SOAPEnvelope envelope = OMAbstractFactory.getSOAP11Factory().getDefaultEnvelope();
        envelope.getBody().addChild(ADBBeanUtil.getOMElement(bean));
        ByteArrayOutputStream buffer = new ByteArrayOutputStream();
        OMOutputFormat format = new OMOutputFormat();
        format.setDoOptimize(true);
        envelope.serialize(buffer, format);
//        envelope.serialize(System.out, format);
        String contentType = format.getContentTypeForMTOM("text/xml");
        Attachments attachments = new Attachments(new ByteArrayInputStream(buffer.toByteArray()), contentType);
        assertEquals(countDataHandlers(bean) + 1, attachments.getAllContentIDs().length);
        MTOMStAXSOAPModelBuilder builder = new MTOMStAXSOAPModelBuilder(StAXUtils.createXMLStreamReader(attachments.getRootPartInputStream()), attachments);
View Full Code Here

        envelope.getBody().addChild(ADBBeanUtil.getOMElement(bean));
        ByteArrayOutputStream buffer = new ByteArrayOutputStream();
        OMOutputFormat format = new OMOutputFormat();
        MultipartWriter mpWriter = AxiomMultipartWriterFactory.INSTANCE.createMultipartWriter(buffer, format.getMimeBoundary());
        OutputStream rootPartWriter = mpWriter.writePart("application/xop+xml; charset=UTF-8; type=\"text/xml\"", "binary", format.getRootContentId());
        envelope.serialize(rootPartWriter, format);
        rootPartWriter.close();
        mpWriter.complete();
//        System.out.write(buffer.toByteArray());
        String contentType = format.getContentTypeForMTOM("text/xml");
        Attachments attachments = new Attachments(new ByteArrayInputStream(buffer.toByteArray()), contentType);
View Full Code Here

        SOAPEnvelope envelope = builder2.getSOAPEnvelope();
        envelope.build();

        StringWriter writer = new StringWriter();
        envelope.serialize(writer);
        writer.flush();

        String s2 = writer.toString();

        assertXMLEqual(s2, xml);
View Full Code Here

                SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI);
        SOAPEnvelope envelope = builder2.getSOAPEnvelope();
        envelope.build();

        StringWriter writer = new StringWriter();
        envelope.serialize(writer);
        writer.flush();

        XMLStreamReader r = StAXUtils.createXMLStreamReader(new StringReader(writer.toString()));
        PrintEvents.print(r);
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

    SOAPHeader sh = se.getHeader();
    Iterator iter = sh.getChildElements();
    while(iter.hasNext())iter.next();

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

    checkBodyExists(sw.toString());
  }

  public void testBodyPreservedSerializeAndConsume() throws Exception{
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.