One of the interesting new features of WSE 3.0 is the use of MTOM and ability to transmit binary data as a Mime attachment. I have seen a few demos of this (one in Mark Fussell’s overview video, the other, a grok talk by John Bristowe) where they used different tcp tracing tools (check out this one from Simon Fell) to see what is truly happening to the attachment over the wire. Last month I tried using the tool that Mark had demo’d with and could never get it to work. Today I used the TCPTrace tool (that’s Simon’s) and was not seeing any messages come through the tcp trace.
This was because, as we all know by now, I am NOT a plumber. I could see Mark setting the Url to a different port in his demo, but when I did that, I was getting an error that my Addressing Actor (on port 8080) was not the same as the real service endpoint (on port 1932).
Mark’s article on What’s new in WSE3.0 even says “if you want to try this out, don’t forget to change the URI” but I could not figure out how.
After some googling I was noticing repeated references not only to Actor but to Via. This finally helped me find the solution.
The goal here (normally only explained in passing by all those plumbers who grok this stuff) is to create an extra little pipe for the message to go through. The trace tool can read from that pipe. We have to lay the one end of the pipe at the true service endpoint (in my case, the one that is on port 1932) and the other end of the pipe we can put on any port we want (I think any ol’ one, but I have mostly seen 8080 used and that’s what I am using myself.). In code, we tell the client where the true endpoint is (the Actor) and the port that we are detouring through (called the Via) . Then the message goes through that pipe where tcp trace is listening and does eventually get poured out into the actual web service. (This happens in reverse also).
So to make it happen, after creating a reference to the proxy in the client, we shove in this information about redirecting the ports:
‘be sure to reference the Addressing namespace
dim wsproxy as new MyWebService()
wsproxy.Destination=new EndpointReference(new Uri(“http://localhost:1932/MyService/MyService.asmx), new Uri(“http://localhost:8080/MyService/MyService.asmx))
Then I tell the tracing utility to listen on port 8080 (my “Via” or detour) and that the destination is at localhost:1932.
And it works. And now I understand it – which I didn’t when I started. Just kept hitting my head with that plumber’s wrench until I figured it out.
Don’t Forget: www.acehaid.org
Sign up for my newsletter so you don't miss my conference & Pluralsight course announcements!