views:

544

answers:

4

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.

A: 

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.

Mike Brown
I'll think about this option. Thank you.
sh0gged
A: 

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

Shiraz Bhaiji
Great article. Thanks for the link. Though i'm using http channel, not tcp channel. That means i have to deal with some soap extensions.
sh0gged
A: 

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%5FAttachments%5F%5FMTOM%5F.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.

andygavin
A: 

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.

sh0gged