private void buildMustUnderstandHeaders(Set<Header> mustUnderstandHeaders, SoapMessage soapMessage, Set<URI> serviceRoles, Set<Header> ultimateReceiverHeaders) { for (Header header : soapMessage.getHeaders()) { if (header instanceof SoapHeader && ((SoapHeader)header).isMustUnderstand()) { String role = ((SoapHeader)header).getActor(); if (!StringUtils.isEmpty(role)) { role = role.trim(); if (role.equals(soapMessage.getVersion().getNextRole())) { mustUnderstandHeaders.add(header); } else if (role.equals(soapMessage.getVersion().getUltimateReceiverRole())) { ultimateReceiverHeaders.add(header); } else { for (URI roleFromBinding : serviceRoles) { if (role.equals(roleFromBinding.toString())) { mustUnderstandHeaders.add(header); } } } } else { // if role omitted, the soap node is ultimate receiver, // needs to understand ultimateReceiverHeaders.add(header); } } } }
private void buildMustUnderstandHeaders(Set<Header> mustUnderstandHeaders, SoapMessage soapMessage, Set<URI> serviceRoles, Set<Header> ultimateReceiverHeaders) { for (Header header : soapMessage.getHeaders()) { if (header instanceof SoapHeader && ((SoapHeader)header).isMustUnderstand()) { String role = ((SoapHeader)header).getActor(); if (!StringUtils.isEmpty(role)) { role = role.trim(); if (role.equals(soapMessage.getVersion().getNextRole())) { mustUnderstandHeaders.add(header); } else if (role.equals(soapMessage.getVersion().getUltimateReceiverRole())) { ultimateReceiverHeaders.add(header); } else { for (URI roleFromBinding : serviceRoles) { if (role.equals(roleFromBinding.toString())) { mustUnderstandHeaders.add(header); } } } } else { // if role omitted, the soap node is ultimate receiver, // needs to understand ultimateReceiverHeaders.add(header); } } } }
public void handleMessage(SoapMessage soapMessage) throws Fault { SoapVersion soapVersion = soapMessage.getVersion(); Set<QName> notFound = new HashSet<>(); List<Header> heads = soapMessage.getHeaders(); for (Header header : heads) { if (header instanceof SoapHeader && ((SoapHeader)header).isMustUnderstand() && header.getDirection() == Header.Direction.DIRECTION_IN && !knownHeaders.contains(header.getName()) && (StringUtils.isEmpty(((SoapHeader)header).getActor()) || soapVersion.getUltimateReceiverRole() .equals(((SoapHeader)header).getActor()))) { notFound.add(header.getName()); } } if (!notFound.isEmpty()) { soapMessage.remove(UNKNOWNS); throw new SoapFault(new Message("MUST_UNDERSTAND", BUNDLE, notFound), soapVersion.getMustUnderstand()); } }
public void handleMessage(SoapMessage soapMessage) throws Fault { SoapVersion soapVersion = soapMessage.getVersion(); Set<QName> notFound = new HashSet<>(); List<Header> heads = soapMessage.getHeaders(); for (Header header : heads) { if (header instanceof SoapHeader && ((SoapHeader)header).isMustUnderstand() && header.getDirection() == Header.Direction.DIRECTION_IN && !knownHeaders.contains(header.getName()) && (StringUtils.isEmpty(((SoapHeader)header).getActor()) || soapVersion.getUltimateReceiverRole() .equals(((SoapHeader)header).getActor()))) { notFound.add(header.getName()); } } if (!notFound.isEmpty()) { soapMessage.remove(UNKNOWNS); throw new SoapFault(new Message("MUST_UNDERSTAND", BUNDLE, notFound), soapVersion.getMustUnderstand()); } }
private void writeSoapAttributes() throws XMLStreamException { if (!firstDone) { firstDone = true; if (!StringUtils.isEmpty(soapHeader.getActor())) { super.writeAttribute(soapPrefix, soapVersion.getNamespace(), soapVersion.getAttrNameRole(), soapHeader.getActor()); } boolean mu = soapHeader.isMustUnderstand(); if (mu) { String mul = soapVersion.getAttrValueMustUnderstand(mu); super.writeAttribute(soapPrefix, soapVersion.getNamespace(), soapVersion.getAttrNameMustUnderstand(), mul); } } } public void writeStartElement(String arg0, String arg1, String arg2)
private void writeSoapAttributes() throws XMLStreamException { if (!firstDone) { firstDone = true; if (!StringUtils.isEmpty(soapHeader.getActor())) { super.writeAttribute(soapPrefix, soapVersion.getNamespace(), soapVersion.getAttrNameRole(), soapHeader.getActor()); } boolean mu = soapHeader.isMustUnderstand(); if (mu) { String mul = soapVersion.getAttrValueMustUnderstand(mu); super.writeAttribute(soapPrefix, soapVersion.getNamespace(), soapVersion.getAttrNameMustUnderstand(), mul); } } } public void writeStartElement(String arg0, String arg1, String arg2)