No need to use SoapMessage in the attachment callback handler
@@ -32,8 +32,8 @@ import javax.security.auth.callback.CallbackHandler;
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.cxf.message.Message;
import org.apache.wss4j.common.ext.AttachmentRemovalCallback;
import org.apache.wss4j.common.ext.AttachmentRequestCallback;
import org.apache.wss4j.common.ext.AttachmentResultCallback;
@@ -43,10 +43,10 @@ import org.apache.wss4j.common.ext.AttachmentResultCallback;
*/
public class AttachmentCallbackHandler implements CallbackHandler {
- private final SoapMessage soapMessage;
+ private final Message message;
- public AttachmentCallbackHandler(SoapMessage soapMessage) {
- this.soapMessage = soapMessage;
+ public AttachmentCallbackHandler(Message message) {
+ this.message = message;
}
@Override
@@ -67,11 +67,11 @@ public class AttachmentCallbackHandler implements CallbackHandler {
} else if (callback instanceof AttachmentResultCallback) {
AttachmentResultCallback attachmentResultCallback = (AttachmentResultCallback) callback;
- if (soapMessage.getAttachments() == null) {
- soapMessage.setAttachments(new ArrayList<Attachment>());
+ if (message.getAttachments() == null) {
+ message.setAttachments(new ArrayList<Attachment>());
}
- final Collection<org.apache.cxf.message.Attachment> attachments = soapMessage.getAttachments();
+ final Collection<org.apache.cxf.message.Attachment> attachments = message.getAttachments();
org.apache.cxf.attachment.AttachmentImpl securedAttachment =
new org.apache.cxf.attachment.AttachmentImpl(
@@ -93,7 +93,7 @@ public class AttachmentCallbackHandler implements CallbackHandler {
AttachmentRemovalCallback attachmentRemovalCallback = (AttachmentRemovalCallback) callback;
String attachmentId = attachmentRemovalCallback.getAttachmentId();
if (attachmentId != null) {
- final Collection<org.apache.cxf.message.Attachment> attachments = soapMessage.getAttachments();
+ final Collection<org.apache.cxf.message.Attachment> attachments = message.getAttachments();
// Calling LazyAttachmentCollection.size() here to force it to load the attachments
if (attachments != null && attachments.size() > 0) { // NOPMD
for (Iterator<org.apache.cxf.message.Attachment> iterator = attachments.iterator();
@@ -118,7 +118,7 @@ public class AttachmentCallbackHandler implements CallbackHandler {
String attachmentId,
boolean removeAttachments
) throws IOException {
- final Collection<org.apache.cxf.message.Attachment> attachments = soapMessage.getAttachments();
+ final Collection<org.apache.cxf.message.Attachment> attachments = message.getAttachments();
// Calling LazyAttachmentCollection.size() here to force it to load the attachments
if (attachments != null && attachments.size() > 0) { // NOPMD
for (Iterator<org.apache.cxf.message.Attachment> iterator = attachments.iterator();
