use of com.sun.xml.ws.message.saaj.SAAJHeader in project metro-jax-ws by eclipse-ee4j.
the class SAAJMessageHeaders method asList.
@Override
public List<Header> asList() {
SOAPHeader soapHeader = ensureSOAPHeader();
if (soapHeader == null) {
return Collections.emptyList();
}
Iterator allHeaders = soapHeader.examineAllHeaderElements();
List<Header> headers = new ArrayList<>();
while (allHeaders.hasNext()) {
SOAPHeaderElement nextHdr = (SOAPHeaderElement) allHeaders.next();
headers.add(new SAAJHeader(nextHdr));
}
return headers;
}
use of com.sun.xml.ws.message.saaj.SAAJHeader in project metro-jax-ws by eclipse-ee4j.
the class SAAJMessageHeaders method getNotUnderstoodHeaders.
@Override
public Set<QName> getNotUnderstoodHeaders(Set<String> roles, Set<QName> knownHeaders, WSBinding binding) {
Set<QName> notUnderstoodHeaderNames = new HashSet<>();
if (notUnderstoodCount == null) {
return notUnderstoodHeaderNames;
}
for (Map.Entry<QName, Integer> header : notUnderstoodCount.entrySet()) {
QName headerName = header.getKey();
int count = header.getValue();
if (count <= 0) {
continue;
}
SOAPHeaderElement hdrElem = find(headerName);
if (!hdrElem.getMustUnderstand()) {
continue;
}
SAAJHeader hdr = new SAAJHeader(hdrElem);
// mustUnderstand attribute is true - but there may be
// additional criteria
boolean understood = false;
if (roles != null) {
understood = !roles.contains(hdr.getRole(soapVersion));
}
if (understood) {
continue;
}
// or is in knownheaders
if (binding instanceof SOAPBindingImpl) {
understood = ((SOAPBindingImpl) binding).understandsHeader(headerName);
if (!understood) {
if (knownHeaders != null && knownHeaders.contains(headerName)) {
understood = true;
}
}
}
if (!understood) {
notUnderstoodHeaderNames.add(headerName);
}
}
return notUnderstoodHeaderNames;
}
use of com.sun.xml.ws.message.saaj.SAAJHeader in project metro-jax-ws by eclipse-ee4j.
the class SAAJMessageHeaders method remove.
@Override
public Header remove(String nsUri, String localName) {
SOAPHeader soapHeader = ensureSOAPHeader();
if (soapHeader == null) {
return null;
}
SOAPHeaderElement headerElem = find(nsUri, localName);
if (headerElem == null) {
return null;
}
headerElem = (SOAPHeaderElement) soapHeader.removeChild(headerElem);
// it might have been a nonSAAJHeader - remove from that map
removeNonSAAJHeader(headerElem);
// remove it from understoodHeaders and notUnderstoodHeaders if present
QName hdrName = (nsUri == null) ? new QName(localName) : new QName(nsUri, localName);
if (understoodHeaders != null) {
understoodHeaders.remove(hdrName);
}
removeNotUnderstood(hdrName);
return new SAAJHeader(headerElem);
}
use of com.sun.xml.ws.message.saaj.SAAJHeader in project metro-jax-ws by eclipse-ee4j.
the class SAAJMessageHeaders method getHeaders.
@Override
public Iterator<Header> getHeaders(final String nsUri, final String localName, final boolean markAsUnderstood) {
SOAPHeader soapHeader = ensureSOAPHeader();
if (soapHeader == null) {
return null;
}
Iterator allHeaders = soapHeader.examineAllHeaderElements();
if (markAsUnderstood) {
// mark all the matchingheaders as understood up front
// make an iterator while we're doing that
List<Header> headers = new ArrayList<>();
while (allHeaders.hasNext()) {
SOAPHeaderElement nextHdr = (SOAPHeaderElement) allHeaders.next();
if (nextHdr != null && nextHdr.getNamespaceURI().equals(nsUri)) {
if (localName == null || nextHdr.getLocalName().equals(localName)) {
understood(nextHdr.getNamespaceURI(), nextHdr.getLocalName());
headers.add(new SAAJHeader(nextHdr));
}
}
}
return headers.iterator();
}
// than traverse the entire list of headers now
return new HeaderReadIterator(allHeaders, nsUri, localName);
}
Aggregations