Package org.apache.axiom.soap

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


                        OMAbstractFactory.getSOAP11Factory(), readerTwo);
    }

    public void testSerilizationWithDefaultNamespaces() throws Exception {
        SOAPEnvelope env = (SOAPEnvelope) builderTwo.getDocumentElement();
        env.serialize(writer);
        OMElement balanceElement = env.getBody().getFirstElement();
        assertEquals("Deafualt namespace has not been set properly",
                     balanceElement.getNamespace().getNamespaceURI(),
                     "http://localhost:8081/axis/services/BankPort/");
View Full Code Here


        ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
        writer = XMLOutputFactory.newInstance().
                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

    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

        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

                format.setIgnoreXMLDeclaration(true);
            }

            SOAPEnvelope envelope = ((SOAPEnvelopeImpl)soapPart.getEnvelope()).getOMEnvelope();
            if (attachmentParts.isEmpty()) {
                envelope.serialize(out, format);
            } else {
                format.setSOAP11(((SOAPEnvelopeImpl)soapPart.getEnvelope()).getOMFactory()
                        instanceof SOAP11Factory);
                Map<String,DataHandler> attachmentsMap = new LinkedHashMap<String,DataHandler>();
                for (AttachmentPart ap : attachmentParts) {
View Full Code Here

                Map<String,DataHandler> attachmentsMap = new LinkedHashMap<String,DataHandler>();
                for (AttachmentPart ap : attachmentParts) {
                    attachmentsMap.put(ap.getContentId(), ap.getDataHandler());
                }
                ByteArrayOutputStream baos = new ByteArrayOutputStream();
                envelope.serialize(baos);
                String contentType =
                        (format.isSOAP11() ? SOAP11Constants.SOAP_11_CONTENT_TYPE :
                                             SOAP12Constants.SOAP_12_CONTENT_TYPE)
                        + "; charset=" + format.getCharSetEncoding();
                DataHandler rootDataHandler =
View Full Code Here

        // Create the producer thread (simulating the client sending the MTOM message)
        Thread producerThread = new Thread(new Runnable() {
            public void run() {
                try {
                    try {
                        orgEnvelope.serialize(pipe1Out, format);
                    } finally {
                        pipe1Out.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.