Package org.apache.axis2.om

Examples of org.apache.axis2.om.OMNode


     * @param soapMsg
     */
    private void extractAttachmentNodes(OMElement element, SOAPMessage soapMsg){
      Iterator childIter = element.getChildren();
      while(childIter.hasNext()) {
        OMNode child = (OMNode)childIter.next();
        if(child instanceof OMText){
          OMText binaryNode = (OMText)child;
          DataHandler actualDH = (DataHandler)binaryNode.getDataHandler();
          if(actualDH != null){
            AttachmentPart ap = soapMsg.createAttachmentPart(actualDH);
            String contentId = SessionUtils.generateSessionId();
            ap.setContentId(contentId);
            ap.setContentType(actualDH.getContentType());
            OMElement parent = (OMElement)child.getParent();
            OMAttribute attr = org.apache.axis2.om.OMAbstractFactory.getOMFactory().createOMAttribute("href", null,"cid:"+contentId);
            parent.addAttribute(attr);
            binaryNode.detach();
            soapMsg.addAttachmentPart(ap);
          }
View Full Code Here


    }

    public void testElementSerilizationChild() throws Exception {
        OMElement elt = builder.getDocumentElement();
        OMNode node = elt.getFirstOMChild().getNextOMSibling();
        node.serialize(writer);

    }
View Full Code Here

    }

    public void testElementSerilizationSOAPBodyCacheOff() throws Exception {
        SOAPEnvelope env = (SOAPEnvelope) builder.getDocumentElement();
        OMNode node = env.getBody();
        node.serialize(writer);
    }
View Full Code Here

            }
        }
        Iterator it = omEle.getChildren();
        if (it != null) {
            while (it.hasNext()) {
                OMNode ele = (OMNode) it.next();
                TestCase.assertNotNull("once the has next is not null, the " +
                        "element should not be null", ele);
                if (ele instanceof OMElement) {
                    walkThrough((OMElement) ele);
                }
View Full Code Here

            NodeList list = ele.getChildNodes();
            for (int i = 0; i < list.getLength(); i++) {
                Node node = list.item(i);
                if (node.getNodeType() == Node.ELEMENT_NODE) {
                    TestCase.assertTrue(it.hasNext());
                    OMNode tempOmNode = (OMNode) it.next();
                    while (tempOmNode.getType() != OMNode.ELEMENT_NODE) {
                        TestCase.assertTrue(it.hasNext());
                        tempOmNode = (OMNode) it.next();
                    }
                    compare((Element) node, (OMElement) tempOmNode);
                }
View Full Code Here

     *
     * @param result
     */
    private void extractDetails(AsyncResult result) {
        Iterator iterator, iterator2;
        OMNode node;
        SOAPBody body;
        OMElement operation, elem;
        SOAPEnvelope resEnvelope;
        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

  }

  protected OMElement getChildWithName(String childName) {
    Iterator childrenIter = getChildren();
    while (childrenIter.hasNext()) {
      OMNode node = (OMNode) childrenIter.next();
      if (node.getType() == OMNode.ELEMENT_NODE
          && childName.equals(((OMElement) node).getLocalName())) {
        return (OMElement) node;
      }
    }
    return null;
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

    OMElement element = getFirstElement();
    if (element != null) {
      if (SOAPConstants.BODY_LOCAL_NAME.equals(element.getLocalName())) {
        return (SOAPBody) element;
      } else { // if not second element SHOULD be the body
        OMNode node = element.getNextOMSibling();
        while (node != null && node.getType() != OMNode.ELEMENT_NODE) {
          node = node.getNextOMSibling();
        }
        element = (OMElement) node;

        if (node != null
            && SOAPConstants.BODY_LOCAL_NAME.equals(element
View Full Code Here

        throw new UnsupportedOperationException(); // TODO implement this
    }

    public ArrayList getHeaderBlocksWithNSURI(String nsURI) {
        ArrayList headers = null;
        OMNode node = null;
        OMElement header = this.getFirstElement();

        if (header != null) {
            headers = new ArrayList();
        }

        node = header;

        while (node != null) {
            if (node.getType() == OMNode.ELEMENT_NODE) {
                header = (OMElement) node;
                if (nsURI.equals(header.getNamespace().getName())) {
                    headers.add(header);
                }
            }
            node = node.getNextOMSibling();

        }
        return headers;

    }
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.