Question

I have a unique problem and I would like the capability to process an incoming HTTP POST request that contains arbitrary binary data.

I can currently process this data using a standard ASP.NET Page handler or in an ASP web service, but I want to know if its possible to processing INCOMING binary data in a WCF service? Can I drill down into the WCF processing stack to bypass the SOAP processing and handle the raw message in my own code?

I understand that this breaks the 'contract' publishing of WCF (WSDL whatever), but I don't really care about that.

-Jeff

Was it helpful?

Solution 4

After spending a few weeks on this problem, I have pretty much a definitive answer:

Can you replace XML/SOAP with a custom binary serialization for WCF?

The short answer: no

The long answer: yes, but you have to rewrite almost all of the transport layer interfaces so you might as well just create a custom IHttpHandler and avoid WCF all together.

Microsoft, in attempting to follow the SOAP standard (and the standard is responsible for this problem in my opinion) breaks one of the simple programming rules -> separation of responsibilities in the layers. WCF/SOAP may appear to be a elegantly layered protocol and transport, but the reality is, is that there are intricate connections between the layers. This means that WCF is an extremely complex communication protocol that provides transport, security, reliability, publishing, serialization and other features that are all interdependent at some level. If all you want is a transport channel, WCF/SOAP adds a tremendous amount of complexity.

I'm sure I could start huge rants about SOAP yes/no, but I finally realized that WCF/SOAP is not what I needed for my application.

-Jeff

OTHER TIPS

Consider using MTOM. MTOM is a mechanism for transmitting large binary attachments with SOAP messages as raw bytes, allowing for smaller messages. For details see:

http://msdn.microsoft.com/en-us/library/aa395209.aspx

You can use streaming MSDN

As long as I know you can configure the service binding: http://www.c-sharpcorner.com/UploadFile/pjthesedays/bindwcf05032009012251AM/bindwcf.aspx

Using the netTcpBinding

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top