Repository: cxf Updated Branches: refs/heads/3.1.x-fixes 814b1f036 -> e6416bea1
Fix returning secured faults when MTOM is enabled Project: http://git-wip-us.apache.org/repos/asf/cxf/repo Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/e6416bea Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/e6416bea Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/e6416bea Branch: refs/heads/3.1.x-fixes Commit: e6416bea1f95356e1bde5b903f9c136b509890d0 Parents: 814b1f0 Author: Colm O hEigeartaigh <[email protected]> Authored: Tue Jan 5 16:32:46 2016 +0000 Committer: Colm O hEigeartaigh <[email protected]> Committed: Tue Jan 5 16:36:21 2016 +0000 ---------------------------------------------------------------------- .../java/org/apache/cxf/binding/soap/SoapBindingFactory.java | 1 + .../apache/cxf/ws/security/wss4j/AttachmentCallbackHandler.java | 5 +++++ 2 files changed, 6 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cxf/blob/e6416bea/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/SoapBindingFactory.java ---------------------------------------------------------------------- diff --git a/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/SoapBindingFactory.java b/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/SoapBindingFactory.java index 1319936..aafa648 100644 --- a/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/SoapBindingFactory.java +++ b/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/SoapBindingFactory.java @@ -396,6 +396,7 @@ public class SoapBindingFactory extends AbstractWSDLBindingFactory { sb.getOutFaultInterceptors().add(new StaxOutInterceptor()); sb.getOutFaultInterceptors().add(new SoapOutInterceptor(getBus())); + sb.getOutFaultInterceptors().add(new AttachmentOutInterceptor()); sb.getInInterceptors().add(new AttachmentInInterceptor()); sb.getInInterceptors().add(new StaxInInterceptor()); http://git-wip-us.apache.org/repos/asf/cxf/blob/e6416bea/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/AttachmentCallbackHandler.java ---------------------------------------------------------------------- diff --git a/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/AttachmentCallbackHandler.java b/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/AttachmentCallbackHandler.java index e2e01e0..0539476 100644 --- a/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/AttachmentCallbackHandler.java +++ b/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/AttachmentCallbackHandler.java @@ -33,6 +33,7 @@ import javax.security.auth.callback.UnsupportedCallbackException; import org.apache.cxf.attachment.AttachmentDataSource; import org.apache.cxf.binding.soap.SoapMessage; +import org.apache.cxf.message.Attachment; import org.apache.wss4j.common.ext.AttachmentRequestCallback; import org.apache.wss4j.common.ext.AttachmentResultCallback; @@ -64,6 +65,10 @@ public class AttachmentCallbackHandler implements CallbackHandler { loadAttachments(attachmentList, attachmentId); } else if (callback instanceof AttachmentResultCallback) { AttachmentResultCallback attachmentResultCallback = (AttachmentResultCallback) callback; + + if (soapMessage.getAttachments() == null) { + soapMessage.setAttachments(new ArrayList<Attachment>()); + } final Collection<org.apache.cxf.message.Attachment> attachments = soapMessage.getAttachments();
