Package org.apache.axiom.soap

Examples of org.apache.axiom.soap.SOAPBody.addChild()


        // Reset the tree
        isds1 = new InputStreamDataSource(
            new ByteArrayInputStream(payload1.getBytes(ENCODING)),
            ENCODING);
        omse = factory.createOMElement(isds1, localName, ns);
        soapBody.addChild(omse);
        firstChild = soapBody.getFirstOMChild();
        child = (OMSourcedElement) firstChild;
       
        // Likewise, an InputStreamDataSource consumes the backing object when
        // written.  Thus serializing the OMSourcedElement should cause the expansion
View Full Code Here


        child.detach();
        isds1 = new InputStreamDataSource(
            new ByteArrayInputStream(payload1.getBytes(ENCODING)),
            ENCODING);
        omse = factory.createOMElement(isds1, localName, ns);
        soapBody.addChild(omse);
        firstChild = soapBody.getFirstOMChild();
        child = (OMSourcedElement) firstChild;
       
        // Test getting the raw bytes from the ByteArrayDataSource.
        OMDataSourceExt ds = (OMDataSourceExt) child.getDataSource();
View Full Code Here

     */
    public void testOMSEReplacement() throws Exception {
        SOAPBody soapBody = soapEnvelope.getBody();
        OMFactory factory = soapBody.getOMFactory();
        OMSourcedElement omse = factory.createOMElement(bads1, localName, ns);
        soapBody.addChild(omse);
        OMNode firstChild = soapBody.getFirstOMChild();
        assertTrue("Expected OMSourcedElement child", firstChild instanceof OMSourcedElement);
        OMSourcedElement child = (OMSourcedElement) firstChild;
        assertTrue("OMSourcedElement is expanded.  This is unexpected", !child.isExpanded());
        assertTrue("OMSourcedElement should be backed by a ByteArrayDataSource",
View Full Code Here

                SOAPEnvelope env = factory.createSOAPEnvelope();
                SOAPHeader header = factory.createSOAPHeader(env);
                SOAPBody body = factory.createSOAPBody(env);
                outMsgContext.setEnvelope(env);
                OMElement respElmt = factory.createOMElement(new QName("http://axis2.ode.apache.org", "faultTestResponse"));
                body.addChild(respElmt);
                respElmt.setText("dummy");
                SOAPHeaderBlock headerBlock = factory.createSOAPHeaderBlock("ConversationId",
                        factory.createOMNamespace("http://my.company/super/protocol", "pns"), header);
                headerBlock.setText("ZZYV");
                AxisEngine.send(outMsgContext);
View Full Code Here

        SOAPBody body = soapFactory.createSOAPBody();
        envelope.addChild(body);

        OMElement valueElement = soapFactory.createOMElement("Value", null);
        valueElement.setText(value);
        body.addChild(valueElement);

        return envelope;
    }

    private int stringToInt(String stringNumber) {
View Full Code Here

        Object[] args = (Object[])msg.getBody();
        if (args != null && args.length > 0) {
            SOAPBody body = env.getBody();
            for (Object bc : args) {
                if (bc instanceof OMElement) {
                    body.addChild((OMElement)bc);
                } else {
                    throw new IllegalArgumentException(
                                                       "Can't handle mixed payloads betweem OMElements and other types.");
                }
            }
View Full Code Here

                    msgCtxt.setProperty(Constants.Configuration.CHARACTER_SET_ENCODING, charSetEnc);
                }

                OMNodeEx documentElement = (OMNodeEx) new StAXOMBuilder(xmlreader).getDocumentElement();
                documentElement.setParent(null);
                body.addChild(documentElement);

                // if the media type is multipart/related, get help from Axis2 :)
            } else
            if (checkContentType(org.apache.axis2.transport.http.HTTPConstants.MEDIA_TYPE_MULTIPART_RELATED, contentType)) {
                body.addChild(TransportUtils.selectBuilderForMIME(msgCtxt,
View Full Code Here

                body.addChild(documentElement);

                // if the media type is multipart/related, get help from Axis2 :)
            } else
            if (checkContentType(org.apache.axis2.transport.http.HTTPConstants.MEDIA_TYPE_MULTIPART_RELATED, contentType)) {
                body.addChild(TransportUtils.selectBuilderForMIME(msgCtxt,
                        inputStream,
                        contentType, false).getDocumentElement());
            }

            return soapEnvelope;
View Full Code Here

                            SOAPFactory factory = OMAbstractFactory.getSOAP11Factory();
                            SOAPEnvelope resEnv = factory.createSOAPEnvelope();
                            SOAPBody resBody = factory.createSOAPBody();
                            OMElement resService = factory.createOMElement(new QName(serviceName + "Response"));
                            resService.addChild(resultSer.getFirstElement());
                            resBody.addChild(resService);
                            resEnv.addChild(resBody);

                            // The declareDefaultNamespace method doesn't work see (https://issues.apache.org/jira/browse/AXIS2-3156)
                            // so the following doesn't work:
                            // resService.declareDefaultNamespace(ModelService.TNS);
View Full Code Here

            SOAPFactory factory = OMAbstractFactory.getSOAP11Factory();
            SOAPEnvelope resEnv = factory.createSOAPEnvelope();
            SOAPBody resBody = factory.createSOAPBody();
            OMElement errMsg = factory.createOMElement(new QName("Response"));
            errMsg.addChild(resultSer.getFirstElement());
            resBody.addChild(errMsg);
            resEnv.addChild(resBody);

            // log the response message
            if (Debug.verboseOn()) {
                try {
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.