Nice WSE 2.0 Tracing tool:
WSE 2.0 Tracing UtilityWith the release of the Web
Services Enhancements 2.0 (go here href="http://msdn.microsoft.com/webservices/building/wse">http://msdn.microsoft.com/webservices/building/wse
for a download) I thought I’d publish my efforts at providing a secondary
tracing utility. WSE 2.0 has tracing facilities that can be switched on via the
configuration file which traces messages to a text file but I wanted something
that looked a little bit more like the SOAPTrace tool that shipped with he SOAP
toolkit so that I can more easily use it for demos and so on.
So, I wrote something. I’m sure it
has flaws but if it’s of use to other people then that’s great and I’ll share it
here – the usual caveats apply around not being intended for any particular
purpose and coming without warranty implied or explicit.
This href="http://mtaulty.com/downloads/WSE2_Tracing_V1.zip">http://mtaulty.com/downloads/WSE2_Tracing_V1.zip
is the URL for download – I’ve not included the source at this point but I can
do that if someone’s keen to get it.
Essentially, what I wrote uses
WSE2.0 SOAP messaging to trace WSE2.0 messaging (be that ASMX or SOAP
messaging).
So, naturally, your messaging slows
down a bit because whenever you send/receive a message if you’ve switched on
tracing I then go and send a copy of your messages over the SOAP.TCP protocol to
the tracing client.
The tracing client looks like
this;
src="http://mtaulty.com/blog/Images/traceclient.jpg" align=baseline
border=0>
So, to work the client
you use File->Start/Stop tracing to start the client listening for messages
and then File->Clear to clear the traces captured and the tree view will
display messages that it has traced going in or out of each process and
application domain that you have configured tracing for. You can configure
tracing to be for incoming or outgoing messages or both.
By default, the tracing client
listens on soap.tcp://localhost:9999/SoapTracer. If, for some reason you don’t
want this you can change it using the Tools->Options dialog box which looks
like this;
align=baseline border=0>
And should allow you to pick a
different endpoint to listen on for those trace messages.
That’s pretty much it for the
tracing client – note that it’s actually persisting the XML to disk in order to
use Internet Explorer to display the XML which is not very clever but was a
quick “win” for me.
So, how do you configure your
applications in order to get their WSE2.0 messages traced to the tracing
client?
Essentially, you modify the
configuration file for the application that you want tracing for. A sample
configuration file is shipped within the MSI and looks like this (except the
real file has more comments in it);
<?xml version="1.0"
encoding="utf-8"?>
size=2><configuration>
<configSections>
<section
name="microsoft.web.services2"
type="Microsoft.Web.Services2.Configuration.WebServicesConfiguration,
Microsoft.Web.Services2, Version=2.0.0.0, Culture=neutral,
PublicKeyToken=31bf3856ad364e35" />
<section
name="WSETraceSettings" type="WSETracingConfig.ConfigHandler, WSETracingConfig,
Version=1.0.0.0, Culture=neutral, PublicKeyToken=1c1f2f7177e1ff79"
/>
</configSections>
<WSETraceSettings
xmlns='urn:wsetrace-mt-com'>
<hostname>127.0.0.1</hostname>
<port>9999</port>
<endpoint>SoapTracer</endpoint>
</WSETraceSettings>
<microsoft.web.services2>
<filters>
<output>
size=2>
<add type="WSETracingFilter.WSEOutputFilter,WSETracingFilter,
Version=1.0.0.0, Culture=Neutral,
PublicKeyToken=1c1f2f7177e1ff79"/>
size=2>
<add type="WSEReorderPipelineFilter.WSETracingReorderOutputFilter,
WSETracingReorderPipelineFilter, Version=1.0.0.0, Culture=Neutral,
PublicKeyToken=1c1f2f7177e1ff79"/>
</output>
<input>
size=2>
<add type="WSETracingFilter.WSEInputFilter,WSETracingFilter, Version=1.0.0.0,
Culture=Neutral, PublicKeyToken=1c1f2f7177e1ff79"/>
size=2>
<add type="WSEReorderPipelineFilter.WSETracingReorderInputFilter,
WSETracingReorderPipelineFilter, Version=1.0.0.0, Culture=Neutral,
PublicKeyToken=1c1f2f7177e1ff79"/>
</input>
</filters>
</microsoft.web.services2>
</configuration>
face=Verdana color=#000080 size=2>
So, the way that the tracing filter is implemented is as a filter for
the WSE 2.0 pipeline so if you want tracing to occur you need to configure it
into that pipeline. This is done through the;
<filters>
color=#000000>
<output>
color=#000000>
<add>
<filters>
color=#000000>
<input>
color=#000000>
<add>
Elements that we have in the configuration file above. Note that you do not
need to have both input and output tracing – it’s entirely up to you. Note that
if you do want filtering then you have to include both add lines in each case
(explanation to follow).
Note that the section within the
<WSETraceSettings>
element is entirely optional and is only necessary if you have changed the
tracing tool (via Tools->Options) to listen on a new endpoint. If you have
done that then you need to configure that endpoint here as well or the trace
messages will not reach the tracing client. It’s important to note that if you
do include this <WSETraceSettings> element then you also need to include
the;
<configSections>
color=#000000>
<section name=”WSETraceSettings” …
in order that the <WSETraceSettings> section can be understood.
That’s pretty much it. I’m keen to take feedback and/or share the source
with people if anyone wants it. Happy to fix bugs for people or rework it
completely if someone spots a fundamental flaw.