Export (0) Print
Expand All
0 out of 1 rated this helpful - Rate this topic

Setting the Url Property of the Web Service

At any time in your Microsoft .NET Framework applications, you can modify the base URL of the Report Server Web service to which your application is currently directed. To do this, simply set the Url property of the service object. For example:

ReportingService2010 service = new ReportingService2010();
rs.Credentials = System.Net.CredentialCache.DefaultCredentials;
rs.Url = "http://<Server Name>/reportserver/ReportService2010.asmx";

The following example retrieves a report definition from one report server and uses that definition to create an identical report on a different report server:

using System;
using System.Web.Services.Protocols;

class Sample
{
   public static void Main()
   {
      ReportingService2010 rs = new ReportingService2010();
      rs.Credentials = System.Net.CredentialCache.DefaultCredentials;
      // Set the base Web service URL of the source server
      rs.Url = "http://<Server Name>/reportserver/reportservice2010.asmx";

      string reportName = "/SampleReports/Company Sales";
      byte[] reportDefinition = null;

      try
      {
         reportDefinition = rs.GetItemDefinition(reportName);
         // Set the base Web service URL of the destination server
         rs.Url = "http://<Server Name>/reportserver/ReportService2010.asmx";
         // Create a copy of the report on the destination server
         Warning[] warnings = {};
         rs.CreateCatalogItem("Report", "Company Sales Copy", "/", false, reportDefinition, null, out warnings);
      }

      catch (SoapException e)
      {
         Console.WriteLine(e.Detail.InnerXml.ToString()); 
      }
   }
}

For more information about creating the initial Web service proxy, see Creating the Web Service Proxy.

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.