public SOAPHeaderElement addNotUnderstoodHeaderElement(QName qname) throws SOAPException { if (Constants.NS_SOAP11_ENV.equals(getNamespaceURI())) throw new UnsupportedOperationException(BundleUtils.getMessage(bundle, "SOAP11_NOT_SUPPORT_NOTUNDERSTOOD")); // create NotUnderstood header block QName notUnderstoodName = new QName(getNamespaceURI(), "NotUnderstood", getPrefix()); SOAPHeaderElement notUnderstoodElement = addHeaderElement(notUnderstoodName); // set qname attribute SAAJUtils.setQualifiedAttributeValue(notUnderstoodElement, "qname", qname); return notUnderstoodElement; }
public Node insertBefore(Node newChild, Node refChild) throws DOMException { if (needsConversionToHeaderElement(newChild)) newChild = convertToHeaderElement(newChild); return super.insertBefore(newChild, refChild); }
public Iterator extractAllHeaderElements() { // make a defensive copy ArrayList<SOAPHeaderElement> list = new ArrayList<SOAPHeaderElement>(); Iterator it = getChildElements(); while (it.hasNext()) { SOAPHeaderElement shElement = (SOAPHeaderElement)it.next(); removeChild(shElement); list.add(shElement); } return list.iterator(); }
/** Attaching a Text node is not legal. */ @Override public SOAPElement addTextNode(String value) throws SOAPException { // JBCTS-440 #addTextNodeTest2 adds a text node to a SOAPHeader and expects a SOAPException if (Constants.NS_SOAP12_ENV.equals(getNamespaceURI())) throw new SOAPException(BundleUtils.getMessage(bundle, "ATTACHING_TEXT_NODE_ILLEGAL", getLocalName())); return super.addTextNode(value); }
/** Returns an Iterator over all the SOAPHeaderElement objects in this SOAPHeader object. */ public Iterator examineAllHeaderElements() { // make a defensive copy ArrayList<SOAPHeaderElement> list = new ArrayList<SOAPHeaderElement>(); Iterator it = getChildElements(); while (it.hasNext()) { SOAPHeaderElement shElement = (SOAPHeaderElement)it.next(); list.add(shElement); } return list.iterator(); }
public SOAPHeaderElement addUpgradeHeaderElement(String[] supportedSoapUris) throws SOAPException { if (supportedSoapUris == null) throw new SOAPException(BundleUtils.getMessage(bundle, "LIST_OF_SUPPORTED_URIS_CANNOT_BE_NULL")); return addUpgradeHeaderElement(Arrays.asList(supportedSoapUris).iterator()); }
public SOAPHeaderElement addHeaderElement(QName qname) throws SOAPException { if (qname == null || qname.getNamespaceURI().length() == 0 || qname.getPrefix().length() == 0) throw new SOAPException(BundleUtils.getMessage(bundle, "INVALID_SOAPHEADERELEMENT_NAME", qname)); SOAPHeaderElementImpl headerElement = new SOAPHeaderElementImpl(qname); addChildElement(headerElement); return headerElement; }
/** Add a SOAPHeaderElement as a child of this SOAPHeader instance. */ public SOAPElement addChildElement(SOAPElement child) throws SOAPException { QName qname = child.getElementQName(); if (qname == null || qname.getNamespaceURI().length() == 0) throw new SOAPException(BundleUtils.getMessage(bundle, "INVALID_SOAPHEADERELEMENT_NAME", qname)); // Check that we get a SOAPHeaderElement if ((child instanceof SOAPHeaderElement) == false) child = convertToHeaderElement(child); return super.addChildElement(child); }
public SOAPHeader addHeader() throws SOAPException { SOAPHeader header = getHeader(); if (header != null) throw new SOAPException(BundleUtils.getMessage(bundle, "SOAPENVELOPE_ALREADY_HAS_A_HEADER_ELEMENT")); header = new SOAPHeaderImpl(getPrefix(), getNamespaceURI()); return (SOAPHeader)addChildElement(header); }
/** Creates a new SOAPHeaderElement object initialized with the specified name and adds it to this SOAPHeader object. */ public SOAPHeaderElement addHeaderElement(Name name) throws SOAPException { if (name == null) throw new SOAPException(BundleUtils.getMessage(bundle, "INVALID_SOAPHEADERELEMENT_NAME", name)); return addHeaderElement(new NameImpl(name.getLocalName(), name.getPrefix(), name.getURI()).toQName()); }
/** Returns an Iterator over all the SOAPHeaderElement objects in this SOAPHeader object that have the specified actor. */ public Iterator examineHeaderElements(String actor) { if (actor == null) throw new IllegalArgumentException(BundleUtils.getMessage(bundle, "INVALID_ACTOR", actor)); // make a defensive copy ArrayList<SOAPHeaderElement> list = new ArrayList<SOAPHeaderElement>(); Iterator it = getChildElements(); while (it.hasNext()) { SOAPHeaderElement shElement = (SOAPHeaderElement)it.next(); if (actor.equals(shElement.getActor())) list.add(shElement); } return list.iterator(); }
public SOAPHeaderElement addUpgradeHeaderElement(String supportedSoapUri) throws SOAPException { if (supportedSoapUri == null) throw new SOAPException(BundleUtils.getMessage(bundle, "SUPPORTED_URI_CANNOT_BE_NULL")); return addUpgradeHeaderElement(Collections.singletonList(supportedSoapUri).iterator()); }
public SOAPHeaderElement addUpgradeHeaderElement(Iterator supportedSoapUris) throws SOAPException { if (supportedSoapUris == null) throw new SOAPException(BundleUtils.getMessage(bundle, "LIST_OF_SUPPORTED_URIS_CANNOT_BE_NULL")); if (!supportedSoapUris.hasNext()) throw new SOAPException(BundleUtils.getMessage(bundle, "LIST_OF_SUPPORTED_URIS_CANNOT_BE_EMPTY")); final String namespaceURI = getNamespaceURI(); final String prefix = getPrefix(); // create Upgrade header block QName upgradeName = new QName(namespaceURI, "Upgrade", prefix); SOAPHeaderElement upgradeElement = addHeaderElement(upgradeName); while (supportedSoapUris.hasNext()) { String soapUri = (String)supportedSoapUris.next(); SOAPElement supportedElement = upgradeElement.addChildElement("SupportedEnvelope", prefix, namespaceURI); SAAJUtils.setQualifiedAttributeValue(supportedElement, "qname", new QName(soapUri, "Envelope")); } return upgradeElement; }
public Node replaceChild(Node newChild, Node oldChild) throws DOMException { if (needsConversionToHeaderElement(newChild)) newChild = convertToHeaderElement(newChild); return super.replaceChild(newChild, oldChild); }
public Iterator extractHeaderElements(String actor) { if (actor == null) throw new IllegalArgumentException(BundleUtils.getMessage(bundle, "INVALID_ACTOR", actor)); // make a defensive copy ArrayList<SOAPHeaderElement> list = new ArrayList<SOAPHeaderElement>(); Iterator it = getChildElements(); while (it.hasNext()) { SOAPHeaderElement shElement = (SOAPHeaderElement)it.next(); if (actor.equals(shElement.getActor())) { removeChild(shElement); list.add(shElement); } } return list.iterator(); }
/** Returns an Iterator over all the SOAPHeaderElement objects in this SOAPHeader object that have the specified * actor and that have a MustUnderstand attribute whose value is equivalent to true. */ public Iterator examineMustUnderstandHeaderElements(String actor) { if (actor == null) throw new IllegalArgumentException(BundleUtils.getMessage(bundle, "INVALID_ACTOR", actor)); // make a defensive copy ArrayList<SOAPHeaderElement> list = new ArrayList<SOAPHeaderElement>(); Iterator it = getChildElements(); while (it.hasNext()) { SOAPHeaderElement shElement = (SOAPHeaderElement)it.next(); if (actor.equals(shElement.getActor()) && shElement.getMustUnderstand()) list.add(shElement); } return list.iterator(); }
public Node appendChild(Node newChild) throws DOMException { if (needsConversionToHeaderElement(newChild)) newChild = convertToHeaderElement(newChild); return super.appendChild(newChild); }