Home > View Post

Part IV. Sending the Data from the Client

Previously, we introduced a series of posts that would show the interesting parts of a (very basic) feedback service implementation. This is part IV, here are the other bits:

Sending the Data From the Client

This should be a pretty short post as there isn't much left to do in our client. We've created the form to collect the feedback and we've grabbed the screen into a byte[] array.

Now we just need to create a reference to our feedback web service either through 'Add Service Reference' in Visual Studio or using svcutil at the command line. Since these tools need the service's metadata we'll need to temporarily enable the serviceMetadata in the services behavior configuration:

        <service name="TheJoyOfCode.FeedbackService.Impl.FeedbackService" behaviorConfiguration="serviceConfig">
            <endpoint contract="TheJoyOfCode.FeedbackService.Model.Interfaces.ISendFeedbackContract" binding="basicHttpBinding" bindingConfiguration="mtomConfig"/>
            <behavior name="serviceConfig">
                <serviceMetadata httpGetEnabled="true"/>
                <serviceDebug includeExceptionDetailInFaults="true"/>
    <!-- etc.... -->
Once we've generated the reference all we need to do is populate the generated Feedback type with the information we've collected and pass


So what was all this fuss about MTOM then? This is the fuss about MTOM:


I captured two transmissions using the awesome Tcp Trace. The first used Mtom encoding and the second Text encoding. Just one little setting reduced the size of the transmission by over 30%!

Binary sent via web services is automatically base64 encoded which is very verbose - this is text encoding. DIME (Direct Internet Message Encapsulation) solved this problem with a more efficient serialization mechanism. However, DIME placed this binary content outside of the message envelope, making it incompatible with many of WS-* protocols (such as security).

MTOM, which stands for Message Transmission Optimization Mechanism and replaces DIME, is a W3C standard that solved all these problems. It uses XOP (Xml-binary Optimized Packaging). The best thing about MTOM is it just works and all this nonsense is neatly abstracted away.

It couldn't be any easier.

Okey dokey. We've finished collecting and sending feedback. We've even stored it in the database. Now, we need to be able to get at that data and view our screen grab...

Part V: Viewing the Binary Image stored in the Database

Tags: .NET

Josh Post By Josh Twist
12:27 PM
09 Aug 2007

» Next Post: Part V. Viewing the Binary Image stored in the Database
« Previous Post: Part III. Grabbing the ScreenShot

Comments are closed for this post.

© 2005 - 2022 Josh Twist - All Rights Reserved.