public Object[] getHeaders(QName name, JAXBContext context, boolean allRoles) { SOAPMessage msg = getMessage(); SOAPHeader header; try { header = msg.getSOAPPart().getEnvelope().getHeader(); if (header == null || !header.hasChildNodes()) { return new Object[0]; } List<Object> ret = new ArrayList<>(); Iterator<SOAPHeaderElement> it = CastUtils.cast(header.examineAllHeaderElements()); while (it.hasNext()) { SOAPHeaderElement she = it.next(); if ((allRoles || roles.contains(she.getActor())) && name.equals(she.getElementQName())) { ret.add(JAXBUtils.unmarshall(context, she)); } } return ret.toArray(new Object[0]); } catch (SOAPException | JAXBException e) { throw new WebServiceException(e); } }
if (elem.getElementQName().equals(securityQName))
/** Set the initial understood/not understood state of the headers in this * object */ private void initHeaderUnderstanding() { SOAPHeader soapHeader = ensureSOAPHeader(); if (soapHeader == null) { return; } Iterator allHeaders = soapHeader.examineAllHeaderElements(); while(allHeaders.hasNext()) { SOAPHeaderElement nextHdrElem = (SOAPHeaderElement) allHeaders.next(); if (nextHdrElem == null) { continue; } if (nextHdrElem.getMustUnderstand()) { notUnderstood(nextHdrElem.getElementQName()); } //only headers explicitly marked as understood should be //in the understoodHeaders set, so don't add anything to //that set at the beginning } }
/** * Determines if the envelope has addressing action header. * * @param soapMessage The SOAPMessage * @return The action addressing header * @throws SOAPException If the envelope could not be read */ public static String getAddressingAction(SOAPMessage soapMessage) throws SOAPException { String action = null; Iterator<SOAPHeaderElement> headers = soapMessage.getSOAPPart().getEnvelope().getHeader().examineAllHeaderElements(); while (headers.hasNext()) { SOAPHeaderElement element = headers.next(); if (element.getElementQName().equals(WSA_ACTION_QNAME)) { action = element.getValue(); break; } } return action; }
/** * Determines if the envelope has addressing action header. * * @param soapMessage The SOAPMessage * @return The action addressing header * @throws SOAPException If the envelope could not be read */ public static String getAddressingAction(SOAPMessage soapMessage) throws SOAPException { String action = null; Iterator<SOAPHeaderElement> headers = soapMessage.getSOAPPart().getEnvelope().getHeader().examineAllHeaderElements(); while (headers.hasNext()) { SOAPHeaderElement element = headers.next(); if (element.getElementQName().equals(WSA_ACTION_QNAME)) { action = element.getValue(); break; } } return action; }
if (elem.getElementQName().equals(securityQName))
/** Set the initial understood/not understood state of the headers in this * object */ private void initHeaderUnderstanding() { SOAPHeader soapHeader = ensureSOAPHeader(); if (soapHeader == null) { return; } Iterator allHeaders = soapHeader.examineAllHeaderElements(); while(allHeaders.hasNext()) { SOAPHeaderElement nextHdrElem = (SOAPHeaderElement) allHeaders.next(); if (nextHdrElem == null) { continue; } if (nextHdrElem.getMustUnderstand()) { notUnderstood(nextHdrElem.getElementQName()); } //only headers explicitly marked as understood should be //in the understoodHeaders set, so don't add anything to //that set at the beginning } }
/** Set the initial understood/not understood state of the headers in this * object */ private void initHeaderUnderstanding() { SOAPHeader soapHeader = ensureSOAPHeader(); if (soapHeader == null) { return; } Iterator allHeaders = soapHeader.examineAllHeaderElements(); while(allHeaders.hasNext()) { SOAPHeaderElement nextHdrElem = (SOAPHeaderElement) allHeaders.next(); if (nextHdrElem == null) { continue; } if (nextHdrElem.getMustUnderstand()) { notUnderstood(nextHdrElem.getElementQName()); } //only headers explicitly marked as understood should be //in the understoodHeaders set, so don't add anything to //that set at the beginning } }
@SuppressWarnings({"rawtypes"}) private Element extractSecurityToken(final SOAPMessageContext messageContext, final QName securityQName, final QName tokenQName) { try { if (securityQName == null) throw logger.nullArgumentError("securityQName from subclass"); if (tokenQName == null) throw logger.nullArgumentError("tokenQName from subclass"); final SOAPHeader soapHeader = messageContext.getMessage().getSOAPHeader(); final Iterator securityHeaders = soapHeader.getChildElements(securityQName); while (securityHeaders.hasNext()) { final SOAPHeaderElement elem = (SOAPHeaderElement) securityHeaders.next(); // Check if the header is equal to the one this Handler is configured for. if (elem.getElementQName().equals(securityQName)) { final Iterator childElements = elem.getChildElements(tokenQName); while (childElements.hasNext()) { return (Element) childElements.next(); } } } } catch (final SOAPException e) { throwInvalidSecurity(); } return null; }
@SuppressWarnings({"rawtypes"}) private Element extractSecurityToken(final SOAPMessageContext messageContext, final QName securityQName, final QName tokenQName) { try { if (securityQName == null) throw logger.nullArgumentError("securityQName from subclass"); if (tokenQName == null) throw logger.nullArgumentError("tokenQName from subclass"); final SOAPHeader soapHeader = messageContext.getMessage().getSOAPHeader(); final Iterator securityHeaders = soapHeader.getChildElements(securityQName); while (securityHeaders.hasNext()) { final SOAPHeaderElement elem = (SOAPHeaderElement) securityHeaders.next(); // Check if the header is equal to the one this Handler is configured for. if (elem.getElementQName().equals(securityQName)) { final Iterator childElements = elem.getChildElements(tokenQName); while (childElements.hasNext()) { return (Element) childElements.next(); } } } } catch (final SOAPException e) { throwInvalidSecurity(); } return null; }
@SuppressWarnings({ "rawtypes" }) private Element extractSecurityToken(final SOAPMessageContext messageContext, final QName securityQName, final QName tokenQName) { try { if (securityQName == null) throw logger.nullArgumentError("securityQName from subclass"); if (tokenQName == null) throw logger.nullArgumentError("tokenQName from subclass"); final SOAPHeader soapHeader = messageContext.getMessage().getSOAPHeader(); final Iterator securityHeaders = soapHeader.getChildElements(securityQName); while (securityHeaders.hasNext()) { final SOAPHeaderElement elem = (SOAPHeaderElement) securityHeaders.next(); // Check if the header is equal to the one this Handler is configured for. if (elem.getElementQName().equals(securityQName)) { final Iterator childElements = elem.getChildElements(tokenQName); while (childElements.hasNext()) { return (Element) childElements.next(); } } } } catch (final SOAPException e) { throwInvalidSecurity(); } return null; }
public Object[] getHeaders(QName name, JAXBContext context, boolean allRoles) { SOAPMessage msg = getMessage(); SOAPHeader header; try { header = msg.getSOAPPart().getEnvelope().getHeader(); if (header == null || !header.hasChildNodes()) { return new Object[0]; } List<Object> ret = new ArrayList<>(); Iterator<SOAPHeaderElement> it = CastUtils.cast(header.examineAllHeaderElements()); while (it.hasNext()) { SOAPHeaderElement she = it.next(); if ((allRoles || roles.contains(she.getActor())) && name.equals(she.getElementQName())) { ret.add(JAXBUtils.unmarshall(context, she)); } } return ret.toArray(new Object[0]); } catch (SOAPException | JAXBException e) { throw new WebServiceException(e); } }
while (iterator.hasNext()) { final SOAPHeaderElement headerElement = iterator.next(); if (ArjunaConstants.WSARJ_ELEMENT_INSTANCE_IDENTIFIER_QNAME.equals(headerElement.getElementQName())) {
while (iterator.hasNext()) { final SOAPHeaderElement headerElement = iterator.next(); if (ArjunaConstants.WSARJ_ELEMENT_INSTANCE_IDENTIFIER_QNAME.equals(headerElement.getElementQName())) {
while (iterator.hasNext()) { final SOAPHeaderElement headerElement = iterator.next(); if (ArjunaConstants.WSARJ_ELEMENT_INSTANCE_IDENTIFIER_QNAME.equals(headerElement.getElementQName())) {
while (iterator.hasNext()) { final SOAPHeaderElement headerElement = iterator.next(); if (ArjunaConstants.WSARJ_ELEMENT_INSTANCE_IDENTIFIER_QNAME.equals(headerElement.getElementQName())) {
while (soapHeaders.hasNext()) { SOAPHeaderElement soapHeader = soapHeaders.next(); QName qname = soapHeader.getElementQName(); if (matches(qname)) { final Object value;
while (soapHeaders.hasNext()) { SOAPHeaderElement soapHeader = soapHeaders.next(); QName qname = soapHeader.getElementQName(); if (matches(qname)) { final Object value;