如何从Spring中的Soap消息中提取附件

时间:2010-09-10 20:22:57

标签: java web-services spring soap attachment

成功发现了肥皂消息,我可以打印好信封,但附件总是零。即使我通过SoapUI提出了确切的请求,并且附件显示正常。也许这不是提取附件的有效方法。我将它添加到sendandreceive方法。

private class AttachmentWebServiceMessageExtractorImpl implements WebServiceMessageExtractor {
    public Object extractData(WebServiceMessage webServiceMessage) throws IOException, TransformerException {
        Set<ZipFile> attachmentZipFiles = new HashSet<ZipFile>();
        Iterator attachmentIterator = ((SaajSoapMessage)webServiceMessage).getAttachments();
        if(attachmentIterator != null) {
            while(attachmentIterator.hasNext()){
                attachmentZipFiles.add((ZipFile) attachmentIterator.next());
            }
        }
        return attachmentZipFiles;
    }
}

1 个答案:

答案 0 :(得分:0)

AXIOM消息工厂与DOM消息工厂。 DOM无法正确获取附件。