Project Description

Huh, it does what? Given the sheer number of Web methods supported by Reporting Services, you might find yourself asking which web method should you choose for the management task at hand and how should you call it? At the same time, it is likely that Report Manager or Management Studio already supports some aspect of the management feature you want to implement. Wouldn't it be nice to be able to peek under the hood and see what APIs Report Manager or a custom application calls? This is exactly what the Reporting Services Tracer (RsTracer) sample was designed to handle. RsTracer intercepts the server calls and outputs them to a trace listener, such as the Microsoft DebugView for Windows. RsTracer helps you see the APIs that a Reporting Services client invokes and what arguments it passes to each interface. It also intercepts the server response. Armed with this information, you can easily reproduce the same feature in your custom management application. You can use RsTracer with SSRS 2000, 2005, and 2008.

Installing RsTracer

RsTracer is implemented as an ASP.NET HttpModule that plugs into the Reporting Services request/response pipeline. Installing RsTracer requires changing several configuraiton files:
1. Unzip RsTracer.zip, open the RsTracer solution in Visual Studio and build the project.
2. Copy the RsTracer.dll and RsTracer.pdb files to the report server binary folder. The default report server binary folder is Program Files\Microsoft SQL Server\MSRS10.MSSQLSERVER\Reporting Services\ReportServer\bin.
3. Open the report server web.config file in your favorite editor and add RsTracer to the list of the registered HTTP modules, as follows:

<httpModules>
  <clear />
  <add name="RsHttpModule" type="RsTracer.RsHttpModule, RsTracer"/>
  <add name="OutputCache" type="System.Web.Caching.OutputCacheModule"/>
  . . .
</httpModules>

4. Open the report server policy file (rssrvpolicy.config), whose default location is Program Files\Microsoft SQL Server\MSRS10.MSSQLSERVER\Reporting Services\ReportServer and increase the security permissions of the RsTracer module by adding the following XML fragment after the last CodeGroup element.

<CodeGroup class="UnionCodeGroup" version="1" Name="SecurityExtensionCodeGroup"
      Description="Code group for the RsTracer HTTP Module"
      PermissionSetName="FullTrust">
    <IMembershipCondition class="UrlMembershipCondition" version="1"
      Url="C:\Program Files\Microsoft SQL Server\MSRS10.MSSQLSERVER\Reporting Services\ReportServer\bin\RsTracer.dll"/>
</CodeGroup>

5. Optionally, if you want to see the report server system output and you target Reporting Services 2008 be aware that it is configured not to output debug messages. To change this, open the ReportingServicesService.exe.config, whose default location is Program Files\Microsoft SQL Server\MSRS10.MSSQLSERVER\Reporting Services\ReportServer\bin, and add the debugwindow switch to the TraceListeners line as follows:

  <RStrace>
    <add name="FileName" value="ReportServerService_" />
    <add name="FileSizeLimitMb" value="32" />
    <add name="KeepFilesForDays" value="14" />
    <add name="Prefix" value="appdomain, tid, time" />
    <add name="TraceListeners" value="debugwindow,file" />
    <add name="TraceFileMode" value="unique" />
    <add name="Components" value="all:3" />
  </RStrace>

At this point, RsTracer is registered with the report server and you can start using it.

Using RsTracer

Suppose you want to write a custom application to programmatically retrieve the content of a Reporting Services folder. Let's say you don't know which management API updates parameter default values, but you do know that Report Manager has the same feature. Let's see how RsRTracer can help.
1. Download and install Microsoft DebugView for Windows http://technet.microsoft.com/en-us/sysinternals/bb896647.aspx.
2. Run DebugView. To see only the RsTracer trace, click the Filter toolbar button and set up a filter that includes only the RsTracer messages. For example, enter RsTracer*
3. Open Report Manager and navigate to the desired forlder, such as Adventure Works 2008 Sample Reports folder assuming you have installed the Reporting Services sample reports. As you interact with Report Manager, you should see many calls to the report server. You can click the DebugView Clear toolbar button to clear the trace or toggle the Capture button to pause and resume the trace.
4. Click the Clear toolbar button (or press Ctrl-X) to clear the trace.
5. Click the folder link in Report Manager.

rstracer.png

At this point, DebugView should intercept a few method calls, such as ListSecureMethods, GetPermissions, and so on, as shown in the screenshot. Because you are retrieving report content, you deduce that you need a Get or List method. Further down the list you see a ListChildren method that looks promising (line 15). If you hover on the line below it (line 16), you will see the actual SOAP payload including method arguments. You can select the line and press Ctrl-C to copy and Ctrl-V to paste it in Notepad to examine the content more conviently. Each message has a correlation identifier that helps correlate the client request with the server response. For example, line 18 represents the server response to the ListChildren call because it has the same identifier (76). Again, you can copy the line content in Notepad to examine it further.

Last edited Feb 24, 2009 at 6:11 PM by tlachev, version 12