Package org.apache.axis2.om

Examples of org.apache.axis2.om.OMNode


     *
     * @param result
     */
    private void extractDetails(AsyncResult result) {
        Iterator iterator,iterator2;
        OMNode node;
        SOAPBody body;
        OMElement operation, elem;
        SOAPEnvelope resEnvelope;
//        /////////////////////////////////////////
//        try {
//            XMLStreamWriter writer = XMLOutputFactory.newInstance().createXMLStreamWriter(
//                    System.out);
//            result.getResponseEnvelope().serializeWithCache(writer);
//            //part.serialize(writer,false);
//            writer.flush();
//
//        } catch (XMLStreamException e) {
//           // System.out.println("Error occured after responce is received");
//            e.printStackTrace();
//        } catch (FactoryConfigurationError e) {
//            //System.out.println("Error occured after responce is received");
//            e.printStackTrace();
//        }
//        ////////////////////////////////////////////////
        resEnvelope = result.getResponseEnvelope();
        body = resEnvelope.getBody();
        operation = body.getFirstElement();
        if (body.hasFault()){
            snippet =
                    snippet +
                    "A Fault message recieved, Check your Licence key. Else you have reached the" +
                    " daily limit of 1000 requests";
        } else {
            OMElement part = operation.getFirstElement();

            iterator = part.getChildren();
            while (iterator.hasNext()) {
                node = (OMNode) iterator.next();
                if (node.getType() == OMNode.ELEMENT_NODE) {
                    elem = (OMElement) node;
                    String str = elem.getLocalName();
                    //System.out.println(str);
                    if (str.equals("resultElements")) {
                        //System.out.println("Got the Result Elements");
                        Iterator iterator0 = elem.getChildren();
                        while (iterator0.hasNext()) {
                            node = (OMNode) iterator0.next();
                            if (node.getType() == OMNode.ELEMENT_NODE) {
                                elem = (OMElement) node;
                                if (elem.getLocalName().equals("item")) {
                                    iterator2 = elem.getChildren();
                                    while (iterator2.hasNext()) {
                                        node = (OMNode) iterator2.next();
                                        if (node.getType() == OMNode.ELEMENT_NODE) {
                                            elem = (OMElement) node;
                                            String str3 = elem.getLocalName();
                                            System.out.println(str3);
                                            if (elem.getLocalName().equals("snippet")) {
                                                //System.out.println("Got the snippet");
View Full Code Here


        return !waitingDescs.isEmpty();
    }

    public void processRest(OMElement rpcElement) throws Exception {
        // The siblings of this should be SOAP 1.1 independent elements
        OMNode nextElement = rpcElement.getNextOMSibling();
        while (nextElement != null) {
            if (nextElement instanceof OMElement) {
                OMAttribute idAttr =
                        ((OMElement)nextElement).getAttribute(new QName("id"));
                if (idAttr != null) {
                    idFound(idAttr.getAttributeValue(), (OMElement)nextElement);
                }
            }
            nextElement = nextElement.getNextOMSibling();
        }
    }
View Full Code Here

    }

    private void getQueueDeleteStatus(OMElement element) {
        Iterator iterator = element.getChildren();
        while (iterator.hasNext()) {
            OMNode omNode = (OMNode) iterator.next();
            if (omNode.getType() == OMNode.ELEMENT_NODE) {
                OMElement omElement = (OMElement) omNode;
                if (omElement.getLocalName().equals("Status")) {
                    this.readTheQueue(omElement);
                } else {
                    getQueueDeleteStatus(omElement);
View Full Code Here

    }

    private boolean getResults(OMElement element) {
        Iterator iterator = element.getChildren();
        while (iterator.hasNext()) {
            OMNode omNode = (OMNode) iterator.next();
            if (omNode.getType() == OMNode.ELEMENT_NODE) {
                OMElement omElement = (OMElement) omNode;
                if ((omElement.getLocalName().equals("Status"))
                        || (omElement.getLocalName().equals("QueueId"))) {
                    this.getText(omElement);
                } else {
View Full Code Here

     *
     * @param result
     */
    private void extractDetails(AsyncResult result) {
        Iterator iterator, iterator2;
        OMNode node;
        SOAPBody body;
        OMElement operation, elem;
        SOAPEnvelope resEnvelope;
//        /////////////////////////////////////////
//        try {
//            XMLStreamWriter writer = XMLOutputFactory.newInstance().createXMLStreamWriter(
//                    System.out);
//            result.getResponseEnvelope().serializeWithCache(writer);
//            //part.serialize(writer,false);
//            writer.flush();
//
//        } catch (XMLStreamException e) {
//           // System.out.println("Error occured after responce is received");
//            e.printStackTrace();
//        } catch (FactoryConfigurationError e) {
//            //System.out.println("Error occured after responce is received");
//            e.printStackTrace();
//        }
//        ////////////////////////////////////////////////
        resEnvelope = result.getResponseEnvelope();
        body = resEnvelope.getBody();
        operation = body.getFirstElement();
        if (body.hasFault()) {
            snippet =
                    snippet +
                    "A Fault message received, Check your Licence key. Else you have reached the" +
                    " daily limit of 1000 requests";
        } else {
            OMElement part = operation.getFirstElement();

            iterator = part.getChildren();
            while (iterator.hasNext()) {
                node = (OMNode) iterator.next();
                if (node.getType() == OMNode.ELEMENT_NODE) {
                    elem = (OMElement) node;
                    String str = elem.getLocalName();
                    //System.out.println(str);
                    if (str.equals("resultElements")) {
                        //System.out.println("Got the Result Elements");
                        Iterator iterator0 = elem.getChildren();
                        while (iterator0.hasNext()) {
                            node = (OMNode) iterator0.next();
                            if (node.getType() == OMNode.ELEMENT_NODE) {
                                elem = (OMElement) node;
                                if (elem.getLocalName().equals("item")) {
                                    iterator2 = elem.getChildren();
                                    while (iterator2.hasNext()) {
                                        node = (OMNode) iterator2.next();
                                        if (node.getType() ==
                                                OMNode.ELEMENT_NODE) {
                                            elem = (OMElement) node;
                                            String str3 = elem.getLocalName();
                                            if (elem.getLocalName().equals(
                                                    "snippet")) {
View Full Code Here

    }

    private boolean getResults(OMElement element) {
        Iterator iterator = element.getChildren();
        while (iterator.hasNext()) {
            OMNode omNode = (OMNode) iterator.next();
            if (omNode.getType() == OMNode.ELEMENT_NODE) {
                OMElement omElement = (OMElement) omNode;
                if ((omElement.getLocalName().equals("QueueId"))
                        || (omElement.getLocalName().equals("QueueName"))) {

                    if (omElement.getLocalName().equals("QueueId")) {
View Full Code Here

    }

    private boolean getResults(OMElement element) {
        Iterator iterator = element.getChildren();
        while (iterator.hasNext()) {
            OMNode omNode = (OMNode) iterator.next();
            if (omNode.getType() == OMNode.ELEMENT_NODE) {
                OMElement omElement = (OMElement) omNode;
                if (omElement.getLocalName().equals("Status")) {
                    this.getText(omElement);
                } else {
                    getResults(omElement);
View Full Code Here

    }

    private void getQueueEntryBody(OMElement element) {
        Iterator iterator = element.getChildren();
        while (iterator.hasNext()) {
            OMNode omNode = (OMNode) iterator.next();
            if (omNode.getType() == OMNode.ELEMENT_NODE) {
                OMElement omElement = (OMElement) omNode;
                if (omElement.getLocalName().equals("QueueEntryBody")) {
                    this.readTheQueue(omElement);
                } else {
                    getQueueEntryBody(omElement);
View Full Code Here

        rootElement = stAXOMBuilder.getDocumentElement();
        assertTrue("Root element can not be null", rootElement != null);
        assertTrue(" Name of the root element is wrong",
                rootElement.getLocalName().equalsIgnoreCase("Root"));
        // get the first OMElement child
        OMNode omnode = rootElement.getFirstChild();
        while (omnode instanceof OMText) {
            omnode = omnode.getNextSibling();
        }
        Iterator children = ((OMElement) omnode).getChildren();
        int childrenCount = 0;
        while (children.hasNext()) {
            OMNode node = (OMNode) children.next();
            if (node instanceof OMElement)
                childrenCount++;
        }
        assertTrue(childrenCount == 5);
    }
View Full Code Here

    }

    public void testElementSerilizationChild() throws Exception {
        OMElement elt = builder.getDocumentElement();
        OMNode node = elt.getFirstChild().getNextSibling();
        node.serializeWithCache(writer);

    }
View Full Code Here

TOP

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

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.