如何在 Spring 中从 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;
}
}
The soap message successfully comes across, and I can print out the envelope just fine, but the attachments are always zero. Even though I put the exact request through SoapUI, and the attachments show up fine in that. Maybe this isn't a valid way to extract the attachments. I'm adding this to the sendandreceive method.
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;
}
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
AXIOM 消息工厂与 DOM 消息工厂。 DOM 无法正确获取附件。
AXIOM message factory vs DOM Message Factory. DOM would not properly pick up attachments.