Package javax.xml.soap

Examples of javax.xml.soap.Node


           
           
            if (sh != null) {
              Iterator it = sh.getChildElements();
              while (it.hasNext()) {
                Node node = (Node) it.next();
                System.out.println("Name: " + node.getNodeName() + " - Value: " + node.getValue());
              }
            }
      }
    } catch (Exception e) {
      e.printStackTrace();
View Full Code Here


     */
    private String getText(SOAPHeaderElement headerElement) {
        String text = " : ";
        Iterator children = headerElement.getChildElements();
        while (children.hasNext()) {
            Node n = (Node)children.next();
            text += n.getLocalName() != null ? n.getLocalName() + "=" : "";
            text += getValue(n) + " ";
        }
        return text;
    }
View Full Code Here

            else {
                getContentHandler().startElement("", "", elementName.getQualifiedName(), getAttributes(element));
            }
        }
        for (Iterator<?> iterator = element.getChildElements(); iterator.hasNext();) {
            Node child = (Node) iterator.next();
            handleNode(child);
        }
        if (getContentHandler() != null) {
            if (namespacesFeature) {
                getContentHandler()
View Full Code Here

       
        final NodeList digestMethodNodes =
            (NodeList) digestAlgoExpr.evaluate(signedDoc, XPathConstants.NODESET);
       
        for (int i = 0; i < digestMethodNodes.getLength(); i++) {
            Node node = (Node)digestMethodNodes.item(i);
            String digestAlgorithm = node.getAttributes().getNamedItem("Algorithm").getNodeValue();
            assertEquals(expectedDigestAlgorithm, digestAlgorithm);
        }
       
        // Canonicalization Algorithm
        final XPathExpression canonAlgoExpr =
View Full Code Here

        final NodeList strKeyIdNodes =
            (NodeList) strExpr.evaluate(signedDoc, XPathConstants.NODESET);
       
        String strId = null;
        for (int i = 0; i < strKeyIdNodes.getLength(); i++) {
            Node keyIdNode = (Node) strKeyIdNodes.item(i);
            String strKey = keyIdNode.getTextContent();
            if (strKey.equals(assertionId)) {
                Node strNode = (Node) keyIdNode.getParentNode();
                strId = strNode.getAttributes().
                    getNamedItemNS(nsContext.getNamespaceURI("wsu"), "Id").getNodeValue();
                break;
            }
        }
        assertNotNull("SecurityTokenReference for " + assertionId + " not found in security header.", strId);
       
        // Verify STR is included in the signature references
        final XPathExpression sigRefExpr = xpath.compile(
            "/s:Envelope/s:Header/wsse:Security/ds:Signature/ds:SignedInfo/ds:Reference");
       
        final NodeList sigReferenceNodes =
            (NodeList) sigRefExpr.evaluate(signedDoc, XPathConstants.NODESET);
       
        boolean foundStrReference = false;
        for (int i = 0; i < sigReferenceNodes.getLength(); i++) {
            Node sigRefNode = (Node) sigReferenceNodes.item(i);
            String sigRefURI = sigRefNode.getAttributes().getNamedItem("URI").getNodeValue();
            if (sigRefURI.equals("#" + strId)) {
                foundStrReference = true;
                break;
            }
        }
View Full Code Here

       
        final NodeList digestMethodNodes =
            (NodeList) digestAlgoExpr.evaluate(signedDoc, XPathConstants.NODESET);
       
        for (int i = 0; i < digestMethodNodes.getLength(); i++) {
            Node node = (Node)digestMethodNodes.item(i);
            String digestAlgorithm = node.getAttributes().getNamedItem("Algorithm").getNodeValue();
            assertEquals(expectedDigestAlgorithm, digestAlgorithm);
        }
       
        // Canonicalization Algorithm
        final XPathExpression canonAlgoExpr =
View Full Code Here

        final NodeList strKeyIdNodes =
            (NodeList) strExpr.evaluate(signedDoc, XPathConstants.NODESET);
       
        String strId = null;
        for (int i = 0; i < strKeyIdNodes.getLength(); i++) {
            Node keyIdNode = (Node) strKeyIdNodes.item(i);
            String strKey = keyIdNode.getTextContent();
            if (strKey.equals(assertionId)) {
                Node strNode = (Node) keyIdNode.getParentNode();
                strId = strNode.getAttributes().
                    getNamedItemNS(nsContext.getNamespaceURI("wsu"), "Id").getNodeValue();
                break;
            }
        }
        assertNotNull("SecurityTokenReference for " + assertionId + " not found in security header.", strId);
       
        // Verify STR is included in the signature references
        final XPathExpression sigRefExpr = xpath.compile(
            "/s:Envelope/s:Header/wsse:Security/ds:Signature/ds:SignedInfo/ds:Reference");
       
        final NodeList sigReferenceNodes =
            (NodeList) sigRefExpr.evaluate(signedDoc, XPathConstants.NODESET);
       
        boolean foundStrReference = false;
        for (int i = 0; i < sigReferenceNodes.getLength(); i++) {
            Node sigRefNode = (Node) sigReferenceNodes.item(i);
            String sigRefURI = sigRefNode.getAttributes().getNamedItem("URI").getNodeValue();
            if (sigRefURI.equals("#" + strId)) {
                foundStrReference = true;
                break;
            }
        }
View Full Code Here

            message.put(MessageContext.REFERENCE_PARAMETERS, params);
            SOAPHeader head = msg.getSOAPHeader();
            if (head != null) {
                Iterator<Node> it = CastUtils.cast(head.getChildElements());
                while (it != null && it.hasNext()) {
                    Node nd = it.next();
                    if (nd instanceof SOAPElement) {
                        SOAPElement el = (SOAPElement)nd;
                        if (el.hasAttributeNS(Names.WSA_NAMESPACE_NAME, "IsReferenceParameter")
                            && ("1".equals(el.getAttributeNS(Names.WSA_NAMESPACE_NAME,
                                                             "IsReferenceParameter"))
View Full Code Here

    public void testText2() throws Exception {
        SOAPEnvelope envelope = getSOAPEnvelope();
      SOAPElement se = envelope.addTextNode("This is text");
      Iterator iterator = se.getChildElements();
      Node n = null;
      while (iterator.hasNext()) {
            n = (Node)iterator.next();
            if (n instanceof Text)
                break;
      }
View Full Code Here

    public void testText3() throws Exception {
        SOAPEnvelope envelope = getSOAPEnvelope();
      SOAPElement se = envelope.addTextNode("<!-- This is a comment -->");
      Iterator iterator = se.getChildElements();
      Node n = null;
      while (iterator.hasNext()) {
            n = (Node)iterator.next();
            if (n instanceof Text)
                break;
      }
View Full Code Here

TOP

Related Classes of javax.xml.soap.Node

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.