Package org.apache.axiom.soap

Examples of org.apache.axiom.soap.SOAPBody


   
    // Build SOAP OM
    SOAPEnvelope env1 = createEnvelope(is);
   
    // Add illegal character
    SOAPBody body = env1.getBody();
    OMElement omElement = body.getFirstElement();
    String text = omElement.getText();
    text = text + "[" + insert + "]";
    System.out.println("New Text = " + text);
    omElement.setText(text);
   
View Full Code Here


            // We must be sensitive to the state of the parser.  It is possible that the
            // has not been processed yet.
            if (state == COMPLETE) {
                // Parsing is complete, therefore it is safe to
                // call getBody.
                SOAPBody body = getBody();
                if (body != null) {
                    body.insertSiblingBefore(child);
                    return;
                }
            } else {
                // Flow to here indicates that we are still expanding the
                // envelope.  The body or body contents may not be
View Full Code Here

            //serialize children
            OMElement header = getHeader();
            if ((header != null) && (header.getFirstOMChild() != null)) {
                ((SOAPHeaderImpl) header).internalSerialize(writer, true);
            }
            SOAPBody body = getBody();
            //REVIEW: getBody has statements to return null..Can it be null in any case?
            if (body != null) {
                ((SOAPBodyImpl) body).internalSerialize(writer, true);
            }
            OMSerializerUtil.serializeEndpart(writer);

        } else {
            //Now the caching is supposed to be off. However caching been switched off
            //has nothing to do if the element is already built!
            if (state == COMPLETE || (this.builder == null)) {
                OMSerializerUtil.serializeStartpart(this, writer);
                OMElement header = getHeader();
                if ((header != null) && (header.getFirstOMChild() != null)) {
                    serializeInternally((OMNodeImpl) header, writer);
                }
                SOAPBody body = getBody();
                if (body != null) {
                    serializeInternally((OMNodeImpl) body, writer);
                }
                OMSerializerUtil.serializeEndpart(writer);
            } else {
View Full Code Here

                       SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI.equals(ns);                                                        
            }
        }
       
        // Fallback: Get the body and get the fault information from the body
        SOAPBody body = this.getBody();
        return (body == null) ? false : body.hasFault();
    }
View Full Code Here

    public String getSOAPBodyFirstElementLocalName() {
        QName payloadQName = this.getPayloadQName_Optimized();
        if (payloadQName != null) {
            return payloadQName.getLocalPart();
        }
        SOAPBody body = this.getBody();
        return (body == null) ? null : body.getFirstElementLocalName();
    }
View Full Code Here

        QName payloadQName = this.getPayloadQName_Optimized();
        if (payloadQName != null) {
            return this.factory.createOMNamespace(payloadQName.getNamespaceURI(),
                                                  payloadQName.getPrefix());
        }
        SOAPBody body = this.getBody();
        return (body == null) ? null : body.getFirstElementNS();
    }
View Full Code Here

        super(metaFactory, spec);
    }

    protected void runTest() throws Throwable {
        SOAPEnvelope envelope = soapFactory.createSOAPEnvelope();
        SOAPBody body = soapFactory.createSOAPBody();
        envelope.addChild(body);
        OMNamespace ns = soapFactory.createOMNamespace("http://ns1", "d");
        OMElement payload = soapFactory.createOMElement(new DummySource(), "dummy", ns);
        payload.setNamespace(ns); // This line will cause NoSuchElementException
        body.addChild(payload);
        payload.getBuilder().setCache(false); // Or This line will cause NoSuchElementException
        StringWriter writer = new StringWriter();
        envelope.serializeAndConsume(writer);
//        System.out.println(writer);
    }
View Full Code Here

        super(metaFactory, spec);
    }

    protected void runTest() throws Throwable {
        SOAPEnvelope sourceEnv = soapFactory.getDefaultEnvelope();
        SOAPBody body = sourceEnv.getBody();
       
        // Create a payload
        String text = "<tns:payload xmlns:tns=\"urn://test\">Hello World</tns:payload>";
        String encoding = "UTF-8";
        ByteArrayDataSource bads = new ByteArrayDataSource(text.getBytes(encoding), encoding);
        OMNamespace ns = body.getOMFactory().createOMNamespace("urn://test", "tns");
        OMSourcedElement omse =body.getOMFactory().createOMElement(bads, "payload", ns);
        body.addChild(omse);
        copyAndCheck(sourceEnv);
    }
View Full Code Here

        super(metaFactory, spec);
    }

    protected void runTest() throws Throwable {
        SOAPEnvelope envelope = soapFactory.getDefaultEnvelope();
        SOAPBody body = envelope.getBody();
        assertEquals("Body Test : - Body local name mismatch",
                SOAPConstants.BODY_LOCAL_NAME, body.getLocalName());
        assertEquals("Body Test : - Body namespace mismatch",
                spec.getEnvelopeNamespaceURI(), body.getNamespace().getNamespaceURI());
    }
View Full Code Here

    }

    protected void runTest() throws Throwable {
        SOAPEnvelope envelope = soapFactory.createSOAPEnvelope();
        assertFalse(envelope.hasFault());
        SOAPBody body = soapFactory.createSOAPBody(envelope);
        assertFalse(envelope.hasFault());
        body.addFault(new Exception("This an exception for testing"));
        assertTrue(envelope.hasFault());
    }
View Full Code Here

TOP

Related Classes of org.apache.axiom.soap.SOAPBody

Copyright © 2018 www.massapicom. 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.