Package org.apache.axis2.om

Examples of org.apache.axis2.om.OMNamespace


    }


    private static OMElement getPayload() {
        OMFactory fac = OMAbstractFactory.getOMFactory();
        OMNamespace omNs = fac.createOMNamespace(
                "tcp://localhost:8080/axis2/services/MyService", "example1");
        OMElement method = fac.createOMElement("echo", omNs);
        OMElement value = fac.createOMElement("Text", omNs);
        value.addChild(fac.createText(value, "Axis2 Echo String "));
        method.addChild(value);
View Full Code Here


    private OMElement createEnvelope(String fileName) throws Exception {

        DataHandler expectedDH;
        OMFactory fac = OMAbstractFactory.getOMFactory();
        OMNamespace omNs = fac.createOMNamespace("http://localhost/my", "my");

        OMElement data = fac.createOMElement("mtomSample", omNs);
        OMElement image = fac.createOMElement("image", omNs);
        Image expectedImage;
        expectedImage = new ImageIO()
View Full Code Here

    private OMElement createEnvelope(String fileName) throws Exception {

        DataHandler expectedDH;
        OMFactory fac = OMAbstractFactory.getOMFactory();
        OMNamespace omNs = fac.createOMNamespace("http://example.org/mtom/data", "x");
        OMElement data = fac.createOMElement("Data", omNs);

        File dataFile = new File(fileName);
        FileDataSource dataSource = new FileDataSource(dataFile);
        expectedDH = new DataHandler(dataSource);
View Full Code Here

    }


    private boolean isIgnorable(OMElement elt) {
        if (elt != null) {
            OMNamespace namespace = elt.getNamespace();
            if (namespace != null) {
                return ignorableNamespaceList.contains(namespace.getName());
            } else {
                return false;
            }
        } else {
            return false;
View Full Code Here

    /*
     * @see TestCase#setUp()
     */
    protected void setUp() throws Exception {
       OMNamespace testingNamespace = factory.createOMNamespace(
                        "http://testing.axis2.org", "axis2");
        firstElement = factory.createOMElement("FirstElement", testingNamespace);
        secondElement = factory.createOMElement("SecondElement", factory.createOMNamespace(
                                "http://testing.axis2.org", "axis2"), firstElement);
    }
View Full Code Here

        assertEquals("Namespace having same information, declared in the same context, should share" +
                " the same namespace object",firstElement.getNamespace(), secondElement.getNamespace());
        assertEquals("OMElement children addition has not worked properly", secondElement, firstElement.getFirstElement());

        OMNamespace testNamespace2 = factory.createOMNamespace("ftp://anotherTest.axis2.org", "axis2");
        firstElement.declareNamespace(testNamespace2);

        OMNamespace inheritedSecondNamespace = secondElement.findNamespace(testNamespace2.getName(),
                testNamespace2.getPrefix());
        assertNotNull("Children should inherit namespaces declared in parent", inheritedSecondNamespace);
        assertEquals("inherited namespace uri should be equal", inheritedSecondNamespace.getName(), testNamespace2.getName());
        assertEquals("inherited namespace prefix should be equal", inheritedSecondNamespace.getPrefix(), testNamespace2.getPrefix());


    }
View Full Code Here


    }

    public void testChildDetachment() {
        OMNamespace testNamespace2 = factory.createOMNamespace("ftp://anotherTest.axis2.org", "axis2");
       
        secondElement.detach();
        assertTrue("OMElement children detachment has not worked properly", !secondElement.equals(firstElement.getFirstElement()));
        assertNull("First Element should not contain elements after detaching. ", firstElement.getFirstElement());
        assertNull("First Element should not contain elements after detaching. ", firstElement.getFirstChild());
        assertNull(secondElement.findNamespace(testNamespace2.getName(), testNamespace2.getPrefix()));

        firstElement.addChild(secondElement);
        firstElement.setText("Some Sample Text");

        assertTrue("First added child must be the first child", secondElement.equals(firstElement.getFirstChild()));
View Full Code Here

  public void runTest(String value, String expected) throws XMLStreamException, FactoryConfigurationError, IOException {
   
    SOAPFactory factory = OMAbstractFactory.getSOAP12Factory();
    SOAPEnvelope envelope = factory.getDefaultEnvelope();
    String ns = "http://testuri.org";
    OMNamespace namespace = factory.createOMNamespace(ns,"tst");
   
    String ln = "Child";
   
    OMElement bodyChild = factory.createOMElement(ln,namespace);
    bodyChild.addChild(factory.createText(value));
View Full Code Here

        reqEnv.declareNamespace("http://www.w3.org/2001/XMLSchema-instance", "xsi");
        reqEnv.declareNamespace("http://soapinterop.org/xsd", "s");
        reqEnv.declareNamespace("http://soapinterop.org/", "m");

        SOAPHeader header = omfactory.createSOAPHeader(reqEnv);
        OMNamespace hns = reqEnv.declareNamespace("http://soapinterop.org/echoheader/", "hns"); //xmlns:m0="http://soapinterop.org/echoheader/
        SOAPHeaderBlock block1 = header.addHeaderBlock("echoMeStringRequest", hns);
        block1.addAttribute("xsi:type", "xsd:string", null);
        block1.addChild(omfactory.createText("string"));
        // header.addChild(headerChild);
        header.addChild(block1);
View Full Code Here

        reqEnv.declareNamespace("http://www.w3.org/2001/XMLSchema-instance", "xsi");
        reqEnv.declareNamespace("http://soapinterop.org/xsd", "s");
        reqEnv.declareNamespace("http://soapinterop.org/", "m");

        SOAPHeader header = omfactory.createSOAPHeader(reqEnv);
        OMNamespace hns = reqEnv.declareNamespace("http://soapinterop.org/echoheader/", "hns"); //xmlns:m0="http://soapinterop.org/echoheader/
        SOAPHeaderBlock block1 = header.addHeaderBlock("echoMeStringRequest", hns);
        block1.addAttribute("xsi:type", "xsd:string", null);
        block1.addChild(omfactory.createText("string"));
        // header.addChild(headerChild);
        header.addChild(block1);
View Full Code Here

TOP

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

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.