Formatting the Reporting Services Script File
A Reporting Services script is a Microsoft Visual Basic .NET code file, written against a proxy that is built on Web Service Description Language (WSDL), which defines the Reporting Services SOAP API. A script file is stored as a Unicode or UTF-8 text file with the extension .rss.
The script file acts as a Visual Basic module and can contain user-defined procedures and module-level variables. For the script file to run successfully, it must contain a Main procedure. The Main procedure is the first procedure that is accessed when your script file runs. Main is where you can add your Web service operations and run your user defined subprocedures. The following code creates a Main procedure:
Public Sub Main() ' Your code goes here. End Sub
The script environment automatically connects to the report server, creates the Web proxy class, and generates a reference variable (rs) to the Web service proxy object. Individual statements that you create need only refer to the rs module-level variable to perform any of the Web service operations that are available in the Web service library. The following Visual Basic code calls the Web service ListChildren method from within a script file:
Public Sub Main() Dim items() As CatalogItem items = rs.ListChildren("/", True) Dim item As CatalogItem For Each item In items Console.WriteLine(item.Name) Next item End Sub
User credentials are managed by the script environment and passed through command prompt arguments through the use of RS.exe. Although you can use the rs variable to set the authentication of the Web service, it is recommended that you use the script environment. You do not need to authenticate the Web service in the script file itself. For more information about authenticating the script environment, see rs Utility.
You do not declare namespaces within the script file. The scripting environment makes several useful Microsoft .NET Framework namespaces available to you: System.Web.Services, System.Web.Services.Protocols, System.Xml, and System.IO.
For script samples, see SQL Server Reporting Services Product Samples.