.net 远程处理的 MTOM/XOP 实现
我的客户要求我通过 HTTP/SOAP 实现 .NET Remoting 的 MTOM/XOP 以进行远程流访问(例如,文件上传)。 WCF Web 服务不是一个选项。
因此,我要做的就是修改我们的自定义 SoapClientFormatterSink 和 SoapServerFormatterSink 来完成这项工作,即 SerializeMessage 方法,该方法采用 IMessage,如果消息参数的值之一为 Stream,则将 XOP 信息集的节点插入到流中,依此类推。
public class CompatibleSoapClientFormatterSink : IClientFormatterSink
{
...
private void SerializeMessage(IMessage message, out ITransportHeaders headers, out Stream stream)
{
...
}
问题是我不明白如何将二进制流放入 SOAP 请求中以及如何实现这种方法。
有人可以指导我如何实施吗?
任何 MTOM/XOP 实现的代码示例将不胜感激。
My customer asked me to implement MTOM/XOP for .NET Remoting via HTTP/SOAP for remote stream access (for example, file uploading). WCF web services in not an option.
So, what I have to do is modify our custom SoapClientFormatterSink and SoapServerFormatterSink to do the job, i.e. SerializeMessage method, which takes IMessage and if one of the message parameter' value of type Stream, XOP infoset's node is inserted into stream and so on.
public class CompatibleSoapClientFormatterSink : IClientFormatterSink
{
...
private void SerializeMessage(IMessage message, out ITransportHeaders headers, out Stream stream)
{
...
}
The problem is I don't understand how to put binary stream into SOAP request and implementation of this approach in general.
Can someone give me direction to how can I implement it please?
Any code sample of MTOM/XOP implementation would be much appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
对不起,伙计们!你的答案都不适合我。
因此,我提出了我已经实施的解决方案的简单想法。
我使用 System.Xml 命名空间中的 XmlMtomReader 和 XmlMtomWriter 类来格式化 SOAP 消息,然后将它们转发到格式化程序接收器。 WCF Web 服务层没有按照我想要的方式触及。
Sorry, guys! Nether of your answers work for me.
So I propose my simple idea of the solution which I already had implemented.
I used XmlMtomReader and XmlMtomWriter classes from System.Xml namespace to format SOAP messages and then pass them forward to the formatter sink. WCF web services layer wasn't touched as I wanted.
我相信WCF(Metro)的Java等效项支持XOP/MTOM,并且它是开源的。您可以获取该代码并将其移植到 .NET Remoting。
I believe that the Java Equivalent of WCF (Metro) supports XOP/MTOM, and it is open source. You could take that code and port it to .NET Remoting.
这是使用 .net 远程处理实现文件传输的人:
http:// /www.codeproject.com/KB/dotnet/Net%5FRemoting%5FEvents.aspx
源代码可通过页面上的链接获取
Here is someone who has implemented file transfer with .net remoting:
http://www.codeproject.com/KB/dotnet/Net%5FRemoting%5FEvents.aspx
Source code is available from a link on the page
您可以尝试:
http://dotnetslackers.com/articles/aspnet/GettingStartedCreatingWSEEnabledWebService.aspx
如果您确实有 Java 服务器端,您可以查看:
https:// /jax-ws.dev.java.net/guide/Binary_Attachments__MTOM_.html
页面底部有一些代码可供下载。
平台之间的 MTOM 存在一些互操作性问题:许多堆栈不支持 .NET 用于打开 MTOM 的 ws-policy 机制。在我看来,这对于互操作性来说是非常不可取的。在这里,我们最终在 app.config 的绑定部分中打开 MTOM messageEncoding。
You could try:
http://dotnetslackers.com/articles/aspnet/GettingStartedCreatingWSEEnabledWebService.aspx
If you do have a java server-side you could look at:
https://jax-ws.dev.java.net/guide/Binary_Attachments__MTOM_.html
there is some code at the bottom of the page for download.
There are some interoperability issues with MTOM between platforms: many stacks don't support the ws-policy mechanism that .NET uses to turn on MTOM. To my mind this is quite undesirable for interoperability. Here we have ended up turning on MTOM messageEncoding in the binding section of the app.config.