Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/349.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 如何在Spring中从Soap消息中提取附件_Java_Web Services_Spring_Soap_Attachment - Fatal编程技术网

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

Java 如何在Spring中从Soap消息中提取附件,java,web-services,spring,soap,attachment,Java,Web Services,Spring,Soap,Attachment,soap消息成功地传递过来,我可以很好地打印出信封,但是附件总是零。即使我通过SoapUI提交了确切的请求,附件也显示得很好。也许这不是提取附件的有效方法。我正在将其添加到sendandreceive方法中 private class AttachmentWebServiceMessageExtractorImpl implements WebServiceMessageExtractor { public Object extractData(WebServiceMessage web

soap消息成功地传递过来,我可以很好地打印出信封,但是附件总是零。即使我通过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;
    }
}
私有类AttachmentWebServiceMessageExtractor MPL实现WebServiceMessageExtractor{
公共对象提取数据(WebServiceMessageWebServiceMessage)引发IOException、TransformerException{
Set attachmentZipFiles=new HashSet();
迭代器attachmentIterator=((SaajSoapMessage)webServiceMessage).getAttachments();
if(attachmentIterator!=null){
while(attachmentIterator.hasNext()){
add((ZipFile)attachmentIterator.next());
}
}
返回附件zipfiles;
}
}

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

可能有一些相关的配置选项?如果您发布更多代码,我将安装SoapUI并尝试运行它,看看会发生什么。好的,我们使用的是DOM MessageFactory,它无法查看附件。一旦我们切换到AXIOM,它工作得很好。