Databases Reference
In-Depth Information
Adding the Web Reference
Now you'll need to modify the assembly references for the project. First, remove the references that are
not needed. In the Solution Explorer, open the References folder to view the current assembly references.
Remove the System.Data reference by right clicking it and selecting Remove from the context menu.
Then right-click the References folder, and select Add Reference.
In the Add Reference dialog box, ensure that you're viewing the .NET tab. Select the System.Web
.Services.dll assembly by clicking the component name, and then click the Select button. That will add
the component to the list of Selected Components in the bottom list box. Click OK to add the reference to
your project.
For development, you'll also need to reference the Reporting Services Web service. To do that, right-click
the References folder in the Solution Explorer and select Add Web Reference to bring up the Add Web
Reference dialog box. This form contains a browser pane, an address bar, and a couple of other items.
In the address bar, type the URL of the Report Server you want to code against. The default URL is
http<s>://<servername>/reportserver/reportservice.asmx .
If you've pointed at a valid Web service, the Add Reference button will be enabled. Before you click it,
however, give the web reference a name; in this case, the reference is called ReportServer .
Clicking the Add Reference button invokes the wsdl.exe utility. The wsdl.exe checks the WSDL docu-
ment for the Web service and creates a proxy class that acts as your local interface to the remote Web ser-
vice. You're creating a Web service proxy in the same way that the RS utility creates it for your hosted
script. Now you can code against that Web service as if it were a local object because in proxy form, it is
a local object.
A Sample Deployment Script
Here's an example of a script used to migrate content from one environment to another. It works against
the RS utility described earlier, and is structured to work in that environment. You'll need to wrap this
code in a console application for it to run in Visual Studio 2005.
The Main method is the entry point into the application, and is where the bulk of the work is done.
Three helper subs are called from Main() . The credentials for the current user are passed to the utility to
provide a security context. Variables are also set up to hold destination values for the source data and
target. The target folder is then created.
Sub Main()
rs.Credentials = System.Net.CredentialCache.DefaultCredentials
Dim dataSourceName As String = “reportsdb”
Dim folderName As String = “Company Reports”
Dim folderPath As String = “/” & folderName
'create the folder “Company Reports”
Try
rs.CreateFolder(folderName, “/”, Nothing)
Console.WriteLine(“Company Reports folder created.”)
Search WWH ::




Custom Search