public String getNamespaceURI(final String prefix) { return currentElement.getNamespaceURI(prefix); } public String getPrefix(final String namespaceURI) {
@Override public String getNamespaceURI(String prefix) { return currentElement.getNamespaceURI(prefix); } @Override
@Override public String getNamespaceURI(final String prefix) { return currentElement.getNamespaceURI(prefix); } @Override
public static boolean isEncryptedKey(SOAPElement elem) { if (MessageConstants.XENC_ENCRYPTED_KEY_LNAME.equals(elem.getLocalName()) && MessageConstants.XENC_NS.equals(elem.getNamespaceURI())) { return true; } return false; }
public static boolean isBinarySecret(SOAPElement elem) { if (MessageConstants.BINARY_SECRET_LNAME.equals(elem.getLocalName()) && WSTrustConstants.WST_NAMESPACE.equals(elem.getNamespaceURI())) { return true; } return false; }
private void addNamespaceDeclaration(Attr attr, SOAPElement parent) throws SOAPException { String value = attr.getNodeValue(); String name = attr.getLocalName(); if (value.equals(parent.getNamespaceURI())) { return; } parent.addNamespaceDeclaration(name, value); }
/** * Returns the URI of the namespace that has the given prefix. * * @param prefix a String giving the prefix of the namespace for which to search * @return a String with the uri of the namespace that has the given prefix */ public String getNamespaceURI(String prefix) { String nsURI = element.getAttribute("xmlns:" + prefix); if (nsURI.length() == 0 && getParentElement() != null) return getParentElement().getNamespaceURI(prefix); return (nsURI.length() > 0 ? nsURI : null); }
public boolean getMustUnderstand() { final String headerURI = getParentElement().getNamespaceURI(); return DOMUtils.getAttributeValueAsBoolean(this, new QName(headerURI, Constants.SOAP11_ATTR_MUST_UNDERSTAND)); }
public String getRole() { final String headerURI = getParentElement().getNamespaceURI(); if (Constants.NS_SOAP11_ENV.equals(headerURI)) throw new UnsupportedOperationException(BundleUtils.getMessage(bundle, "SOAP11_NOT_SUPPORT_ROLE")); Attr roleAttr = getAttributeNodeNS(headerURI, Constants.SOAP12_ATTR_ROLE); return roleAttr != null ? roleAttr.getValue() : null; }
public boolean getRelay() { final String headerURI = getParentElement().getNamespaceURI(); if (Constants.NS_SOAP11_ENV.equals(headerURI)) throw new UnsupportedOperationException(BundleUtils.getMessage(bundle, "SOAP11_NOT_SUPPORT_ROLE")); return DOMUtils.getAttributeValueAsBoolean(this, new QName(headerURI, Constants.SOAP12_ATTR_RELAY)); }
public String getActor() { final String headerURI = getParentElement().getNamespaceURI(); if (!Constants.NS_SOAP11_ENV.equals(headerURI)) return getRole(); Attr actorAttr = getAttributeNodeNS(headerURI, Constants.SOAP11_ATTR_ACTOR); return actorAttr != null ? actorAttr.getValue() : null; }
private static SOAPElement addChildValueElement(SOAPElement codeElement) throws SOAPException { return codeElement.addChildElement("Value", codeElement.getPrefix(), codeElement.getNamespaceURI()); }
public void setRelay(boolean relay) { final SOAPElement header = getParentElement(); final String headerURI = header.getNamespaceURI(); if (Constants.NS_SOAP11_ENV.equals(headerURI)) throw new UnsupportedOperationException(BundleUtils.getMessage(bundle, "SOAP11_NOT_SUPPORT_ROLE")); setAttributeNS(headerURI, header.getPrefix() + ":" + Constants.SOAP12_ATTR_RELAY, Boolean.toString(relay)); }
public void setRole(String roleURI) { final SOAPElement header = getParentElement(); final String headerURI = header.getNamespaceURI(); if (Constants.NS_SOAP11_ENV.equals(headerURI)) throw new UnsupportedOperationException(BundleUtils.getMessage(bundle, "SOAP11_NOT_SUPPORT_ROLE")); setAttributeNS(headerURI, header.getPrefix() + ":" + Constants.SOAP12_ATTR_ROLE, roleURI); }
public void setMustUnderstand(boolean mustUnderstand) { final SOAPElement header = getParentElement(); final String headerURI = header.getNamespaceURI(); setAttributeNS(headerURI, header.getPrefix() + ":" + Constants.SOAP11_ATTR_MUST_UNDERSTAND, mustUnderstand ? "1" : "0"); }
@Override public SOAPElement addChildElement(SOAPElement arg0) throws SOAPException { String uri = arg0.getNamespaceURI(); if(uri == null) return null; String value = arg0.getValue(); if(value == null) value = arg0.getNodeValue(); if(value == null) return null; headers.add(new RpcHeader(uri, arg0.getLocalName(), value)); return arg0; }
public void setActor(String actorURI) { final SOAPElement header = getParentElement(); final String headerURI = header.getNamespaceURI(); if (Constants.NS_SOAP11_ENV.equals(headerURI)) setAttributeNS(headerURI, header.getPrefix() + ":" + Constants.SOAP11_ATTR_ACTOR, actorURI); else setRole(actorURI); }
@Override protected void runTest() throws Throwable { SOAPElement root = newSOAPFactory().createElement("root", "p", "urn:test"); SOAPElement element = root.addChildElement("child"); assertThat(element.getLocalName()).isEqualTo("child"); assertThat(element.getNamespaceURI()).isNull(); assertThat(element.getPrefix()).isNull(); assertThat(element.getParentNode()).isSameAs(root); assertThat(element.getAttributes().getLength()).isEqualTo(0); } }
public SOAPElement addChildElement(SOAPElement soapElement) throws SOAPException { OMNamespace ns = omTarget.getOMFactory().createOMNamespace(soapElement.getNamespaceURI(), soapElement.getPrefix()); SOAPHeaderBlock headerBlock = ((SOAPFactory)this.omTarget.getOMFactory()).createSOAPHeaderBlock( soapElement.getLocalName(), ns, omTarget); SOAPHeaderElementImpl soapHeaderElement = new SOAPHeaderElementImpl(headerBlock); soapHeaderElement.setParentElement(this); return soapHeaderElement; }
public SOAPElement addChildElement(SOAPElement soapElement) throws SOAPException { OMNamespace ns = omTarget.getOMFactory().createOMNamespace(soapElement.getNamespaceURI(), soapElement.getPrefix()); SOAPHeaderBlock headerBlock = ((SOAPFactory)this.omTarget.getOMFactory()).createSOAPHeaderBlock( soapElement.getLocalName(), ns, omTarget); SOAPHeaderElementImpl soapHeaderElement = new SOAPHeaderElementImpl(headerBlock); soapHeaderElement.setParentElement(this); return soapHeaderElement; }