List of usage examples for javax.xml.soap SOAPHeader getChildElements
public Iterator<Node> getChildElements();
From source file:ee.ria.xroad.common.message.SoapParserImpl.java
/** * Checks SOAP header for duplicate fields. * @param soapHeader the SOAP header//from www . java2 s .com */ public static void validateSOAPHeader(SOAPHeader soapHeader) { // Check for duplicate fields Set<QName> fields = new HashSet<>(); Iterator<?> it = soapHeader.getChildElements(); while (it.hasNext()) { Object next = it.next(); if (next instanceof SOAPElement) { SOAPElement soapElement = (SOAPElement) next; if (!fields.add(soapElement.getElementQName())) { throw new CodedException(X_DUPLICATE_HEADER_FIELD, "SOAP header contains duplicate field '%s'", soapElement.getElementQName()); } } } }
From source file:com.nortal.jroad.endpoint.AbstractXTeeBaseEndpoint.java
@SuppressWarnings("unchecked") private XTeeHeader parseXteeHeader(SOAPMessage paringMessage) throws SOAPException { XTeeHeader pais = new XTeeHeader(); if (paringMessage.getSOAPHeader() == null) { return pais; }/* w w w . j a v a 2 s . c o m*/ SOAPHeader header = paringMessage.getSOAPHeader(); for (Iterator<Node> headerElemendid = header.getChildElements(); headerElemendid.hasNext();) { Node headerElement = headerElemendid.next(); if (!SOAPUtil.isTextNode(headerElement) && headerElement.getFirstChild() != null) { String localName = headerElement.getLocalName(); String value = headerElement.getFirstChild().getNodeValue(); pais.addElement(new QName(headerElement.getNamespaceURI(), localName), value); } } return pais; }
From source file:org.apache.axis2.jaxws.message.impl.XMLPartBase.java
public Set<QName> getHeaderQNames() { try {/*w ww . ja va 2 s . com*/ switch (contentType) { case OM: { HashSet<QName> qnames = new HashSet<QName>(); OMElement om = this.getAsOMElement(); if (om instanceof org.apache.axiom.soap.SOAPEnvelope) { org.apache.axiom.soap.SOAPEnvelope se = (org.apache.axiom.soap.SOAPEnvelope) om; org.apache.axiom.soap.SOAPHeader header = se.getHeader(); if (header != null) { Iterator it = header.getChildElements(); while (it != null && it.hasNext()) { Object node = it.next(); if (node instanceof OMElement) { qnames.add(((OMElement) node).getQName()); } } } } return qnames; } case SOAPENVELOPE: { HashSet<QName> qnames = new HashSet<QName>(); SOAPEnvelope se = this.getContentAsSOAPEnvelope(); if (se != null) { SOAPHeader header = se.getHeader(); if (header != null) { Iterator it = header.getChildElements(); while (it != null && it.hasNext()) { Object node = it.next(); if (node instanceof SOAPElement) { qnames.add(((SOAPElement) node).getElementQName()); } } } } return qnames; } case SPINE: return getContentAsXMLSpine().getHeaderQNames(); default: return null; } } catch (SOAPException se) { throw ExceptionFactory.makeWebServiceException(se); } }