Package org.apache.axis2.om

Examples of org.apache.axis2.om.OMFactory


*/
public class EchoExtendedStructFaultClientUtil implements SunGroupHClientUtil{

    public OMElement getEchoOMElement() {

        OMFactory fac = OMAbstractFactory.getOMFactory();

        OMNamespace omNs = fac.createOMNamespace("http://soapinterop.org/wsdl", "m");

        OMElement method = fac.createOMElement("echoExtendedStructFault", omNs);
        OMNamespace soapEnvNS = method.declareNamespace(SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI,
                SOAP11Constants.SOAP_DEFAULT_NAMESPACE_PREFIX);
        method.addAttribute("encodingStyle", "http://schemas.xmlsoap.org/soap/encoding/", soapEnvNS);



        OMElement value1 = fac.createOMElement("param", null);
        method.addChild(value1);

        OMElement value2 = fac.createOMElement("floatMessage", null);
        OMElement value3 = fac.createOMElement("shortMessage", null);
        OMElement value4 = fac.createOMElement("stringMessage", null);
        OMElement value5 = fac.createOMElement("intMessage", null);
        OMElement value6 = fac.createOMElement("anotherIntMessage", null);

        value1.addChild(value2);
        value1.addChild(value3);
        value1.addChild(value4);
        value1.addChild(value5);
        value1.addChild(value6);

        method.addChild(value1);

        value2.addChild(fac.createText(value2, "0.99"));
        value3.addChild(fac.createText(value3, "10"));
        value4.addChild(fac.createText(value4, "hi"));
        value5.addChild(fac.createText(value5, "1"));
        value6.addChild(fac.createText(value6, "56"));



        return method;
    }
View Full Code Here


* white Mesa Cr interop test
*/
public class BodyElements {

    public static OMElement bodySingle(boolean optimized) {
        OMFactory fac = OMAbstractFactory.getOMFactory();
        OMNamespace omNS = fac.createOMNamespace("http://example.org/mtom/data", "x");
        OMElement data = fac.createOMElement("Data", omNS);
        File file = null;
        DataHandler handler = null;
        file = new File("modules/integration/itest-resources/mtom/mtom.bin");
        if (file.exists()) {
            handler = new DataHandler(new FileDataSource(file));//
        } else {
            file = new File("itest-resources/mtom/mtom.bin");
            if (file.exists()) {
                handler = new DataHandler(new FileDataSource(file));//
            }
        }

        OMText txt = fac.createText(handler, optimized);
        data.addChild(txt);
        return data;
    }
View Full Code Here

        data.addChild(txt);
        return data;
    }

    public static OMElement bodyMultiple(boolean optimzed, int repeat) {
        OMFactory fac = OMAbstractFactory.getOMFactory();
        OMNamespace omNS = fac.createOMNamespace("http://example.org/mtom/data", "x");
        OMElement echoTest = fac.createOMElement("EchoTest", omNS);
//
        File file = null;
        DataHandler handler = null;
        file = new File("modules/integration/itest-resources/mtom/mtom.bin");
        if (file.exists()) {
            handler = new DataHandler(new FileDataSource(file));//
        } else {
            file = new File("itest-resources/mtom/mtom.bin");
            if (file.exists()) {
                handler = new DataHandler(new FileDataSource(file));//
            }
        }
        for (int i = 0 ; i < repeat ; i++ ) {
            OMElement ele = fac.createOMElement("Data",omNS);
            OMText txt = fac.createText(handler,optimzed);
            ele.addChild(txt);
            echoTest.addChild(ele);
        }       
        return echoTest;
    }
View Full Code Here

                    .printStackTrace();
        }
    }

    public static OMElement payload() {
        OMFactory fac = OMAbstractFactory.getOMFactory();
        OMNamespace omNs = fac.createOMNamespace(
                "urn:synapse-body", "ns");
        OMElement method = fac.createOMElement("service", omNs);
        OMElement value = fac.createOMElement("text", omNs);
        value.addChild(
                fac.createText(value, "Synapse Sample String"));
        method.addChild(value);
        return method;
    }
View Full Code Here

        super(testName);
    }

    public void testChildrenRetrievalWithDetaching() {

        OMFactory factory = OMAbstractFactory.getOMFactory();
        OMNamespace testNamespace = factory.createOMNamespace("http://test.axis2.org", "test");
        OMElement documentElement = getSampleDocumentElement(testNamespace);

        Iterator childrenIter = new OMChildrenWithSpecificAttributeIterator(
                documentElement.getFirstOMChild(), new QName(testNamespace.getName(), "myAttr",
                testNamespace.getPrefix()), "Axis2", true);
View Full Code Here

    }

    public void testChildrenRetrievalWithNoDetaching() {

        OMFactory factory = OMAbstractFactory.getOMFactory();
        OMNamespace testNamespace = factory.createOMNamespace("http://test.axis2.org", "test");
        OMElement documentElement = getSampleDocumentElement(testNamespace);

        Iterator childrenIter = new OMChildrenWithSpecificAttributeIterator(
                documentElement.getFirstOMChild(), new QName(testNamespace.getName(), "myAttr",
                testNamespace.getPrefix()), "Axis2", false);
View Full Code Here

        assertEquals("Iterator must return 6 children, having not detached the children", childCount, 6);

    }

    private OMElement getSampleDocumentElement(OMNamespace testNamespace){
        OMFactory factory = OMAbstractFactory.getOMFactory();

        OMElement documentElement = factory.createOMElement("Employees", testNamespace);
        documentElement.declareNamespace(testNamespace);

        OMElement employee;
        OMElement name;

        for (int i = 0; i < 5; i++) {
            employee = factory.createOMElement("Employee", testNamespace, documentElement);
            name = factory.createOMElement("Name"+i, testNamespace);
            employee.addAttribute("myAttr", "Axis2", testNamespace);
            name.setText("Apache Developer");
            employee.addChild(name);
        }

        //adding one more child with the given attr
        employee = factory.createOMElement("Employee", testNamespace, documentElement);
        name = factory.createOMElement("Name", testNamespace);
        name.addAttribute("myAttr", "Un-Related Value", testNamespace);
        name.setText("Apache Developer");
        employee.addChild(name);

        return documentElement;
View Full Code Here

    private void writeSchemas(Element element) throws XMLStreamException {
        writer.flush();
        String schemaTypes = DOM2Writer.nodeToString(element);
        XMLStreamReader xmlReader = XMLInputFactory.newInstance().createXMLStreamReader(new
                ByteArrayInputStream(schemaTypes.getBytes()));
        OMFactory fac = OMAbstractFactory.getOMFactory();

        StAXOMBuilder staxOMBuilder = new StAXOMBuilder(fac, xmlReader);
        OMElement schemaElement = staxOMBuilder.getDocumentElement();
        schemaElement.serialize(writer);
    }
View Full Code Here

        } catch (OMException e) {
        }
    }

    String buildBlankOMElem() throws XMLStreamException {
        OMFactory factory = OMAbstractFactory.getOMFactory();
        OMNamespace namespace1 = factory.createOMNamespace("", "");
        OMElement elem1 = factory.createOMElement("", namespace1);

        StringWriter writer = new StringWriter();
        elem1.build();
        elem1.serialize(writer);
        writer.flush();
View Full Code Here

        } catch (OMException e) {
        }
    }

    String buildWithWhiteSpaceOMElem() throws XMLStreamException {
        OMFactory factory = OMAbstractFactory.getOMFactory();
        OMNamespace namespace1 = factory.createOMNamespace("  ", "");
        OMElement elem1 = factory.createOMElement("  ", namespace1);

        StringWriter writer = new StringWriter();
        elem1.build();
        elem1.serialize(writer);
        writer.flush();
View Full Code Here

TOP

Related Classes of org.apache.axis2.om.OMFactory

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.