|
56 | 56 | import org.apache.cxf.binding.soap.Soap12;
|
57 | 57 | import org.apache.cxf.binding.soap.SoapBindingConstants;
|
58 | 58 | import org.apache.cxf.binding.soap.SoapHeader;
|
| 59 | +import org.apache.cxf.common.util.StringUtils; |
59 | 60 | import org.apache.cxf.endpoint.Client;
|
60 | 61 | import org.apache.cxf.endpoint.Endpoint;
|
61 | 62 | import org.apache.cxf.headers.Header;
|
@@ -180,9 +181,7 @@ public void populateExchangeFromCxfResponse(Exchange camelExchange,
|
180 | 181 |
|
181 | 182 | // propagate protocol headers
|
182 | 183 | propagateHeadersFromCxfToCamel(cxfMessage, camelExchange.getOut(), camelExchange);
|
183 |
| - DataFormat dataFormat = camelExchange.getProperty(CxfConstants.DATA_FORMAT_PROPERTY, |
184 |
| - DataFormat.class); |
185 |
| - boolean isXop = Boolean.valueOf(camelExchange.getProperty(Message.MTOM_ENABLED, String.class)); |
| 184 | + |
186 | 185 | // propagate attachments
|
187 | 186 | if (cxfMessage.getAttachments() != null) {
|
188 | 187 | // propagate attachments
|
@@ -761,15 +760,19 @@ protected static Object getContentFromCxf(Message message, DataFormat dataFormat
|
761 | 760 | }
|
762 | 761 |
|
763 | 762 | protected static void addNamespace(Element element, Map<String, String> nsMap) {
|
764 |
| - for (String ns : nsMap.keySet()) { |
| 763 | + for (Map.Entry<String, String> ns : nsMap.entrySet()) { |
765 | 764 | // We should not override the namespace setting of the element
|
766 |
| - if (XMLConstants.XMLNS_ATTRIBUTE.equals(ns)) { |
| 765 | + if (XMLConstants.XMLNS_ATTRIBUTE.equals(ns.getKey())) { |
| 766 | + if (ObjectHelper.isEmpty(element.getAttribute(XMLConstants.XMLNS_ATTRIBUTE))) { |
| 767 | + element.setAttributeNS(XMLConstants.XMLNS_ATTRIBUTE_NS_URI, ns.getKey(), ns.getValue()); |
| 768 | + } |
| 769 | + } else if (StringUtils.isEmpty(ns.getKey())) { |
767 | 770 | if (ObjectHelper.isEmpty(element.getAttribute(XMLConstants.XMLNS_ATTRIBUTE))) {
|
768 |
| - element.setAttribute(ns, nsMap.get(ns)); |
| 771 | + element.setAttributeNS(XMLConstants.XMLNS_ATTRIBUTE_NS_URI, "xmlns", ns.getValue()); |
769 | 772 | }
|
770 | 773 | } else {
|
771 |
| - if (ObjectHelper.isEmpty(element.getAttribute(XMLConstants.XMLNS_ATTRIBUTE + ":" + ns))) { |
772 |
| - element.setAttribute(XMLConstants.XMLNS_ATTRIBUTE + ":" + ns, nsMap.get(ns)); |
| 774 | + if (ObjectHelper.isEmpty(element.getAttribute(XMLConstants.XMLNS_ATTRIBUTE + ":" + ns.getKey()))) { |
| 775 | + element.setAttributeNS(XMLConstants.XMLNS_ATTRIBUTE_NS_URI, XMLConstants.XMLNS_ATTRIBUTE + ":" + ns.getKey(), ns.getValue()); |
773 | 776 | }
|
774 | 777 | }
|
775 | 778 | }
|
|
0 commit comments