如何将文件上传到 SOAP Web 服务? [英] How to upload a file to a SOAP web service?

查看:59
本文介绍了如何将文件上传到 SOAP Web 服务?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个 .p12 文件,我想将其上传到 SOAP Web 服务,以便我的应用程序可以在以后发出请求以获取它.我如何上传这个文件?

I have a .p12 file that I want to upload to a SOAP web service, so that my application can make requests to get it later. How do I upload this file?

我不一定希望在我的应用程序代码中使用它,因为这是我只想做一次的事情.但是,如果重要的话,我使用的是 Java.

I don't necessarily want this in my application code, since it's something I only want to do once. But, if it matters, I am using Java.

推荐答案

你应该看看 MTOM,如果服务支持它.如果它接受文件附件,则它可能使用 MTOM.不知道将它保留在应用程序代码之外是什么意思,但是如何创建和发送附件取决于您使用的 Web 服务平台.以下是有关在 Java 的 JAX-WS 中发送附件的最新文档:

You should take a look at MTOM, if the service supports it. If it accepts file attachments, then it probably uses MTOM. Not sure what you mean by keeping it out of application code, but how you go about creating and sending an attachment depends on what web service platform you're using. Here's the latest documentation on sending attachments in Java's JAX-WS:

http://metro.java.net/guide/ch06.html#binary-attachments-mtom

如果您想以独立于语言的方式查看实际发生的情况,请获取 SoapUI 并将其设置为使用 MTOM 发送您的附件:

If you want to see what is actually happening in a language-independent manner, then grab SoapUI and set it up to send your attachment with MTOM:

http://www.soapui.org/SOAP-and-WSDL/adding-headers-and-attachments.html

这篇关于如何将文件上传到 SOAP Web 服务?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆