for (SOAPElement parent = elem.getParentElement(); parent != null; parent = parent.getParentElement()) { for (int i = 0; i < parent.getAttributes().getLength(); i++) { Attr att = (Attr) parent.getAttributes().item(i); if (att.getName().startsWith("xmlns:") && elem.getAttributeNodeNS(att.getNamespaceURI(), att.getLocalName()) == null) { elem.setAttributeNS(att.getNamespaceURI(), att.getName(), att.getValue()); } } }
    public void toNMS(NormalizedMessage normalizedMessage, SOAPMessage soapMessage) throws MessagingException, SOAPException {        addNmsProperties(normalizedMessage, soapMessage);        SOAPPart soapPart = soapMessage.getSOAPPart();        SOAPBody soapBody = soapPart.getEnvelope().getBody();        SOAPElement elem = (SOAPElement) soapBody.getChildElements().next();        normalizedMessage.setContent(new DOMSource(elem));        addNmsAttachments(normalizedMessage, soapMessage);    }