Définition de la propriété Url du service WebSetting the Url Property of the Web Service

Dans vos applications MicrosoftMicrosoft .NET Framework.NET Framework, vous pouvez à tout moment modifier l’URL de base du service web Report Server vers lequel votre application est actuellement dirigée.At any time in your MicrosoftMicrosoft .NET Framework.NET Framework applications, you can modify the base URL of the Report Server Web service to which your application is currently directed. Pour ce faire, il vous suffit de définir la propriété Url de l’objet de service.To do this, simply set the Url property of the service object. Par exemple :For example:

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

L'exemple suivant extrait une définition de rapport d'un premier serveur de rapports et utilise cette définition pour créer un rapport identique sur un serveur de rapports différent :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:

Imports System  
Imports System.Web.Services.Protocols  
  
Class Sample  
   Public Shared Sub Main()  
      Dim rs As New ReportingService2010()  
      rs.Credentials = System.Net.CredentialCache.DefaultCredentials  
      ' Set the base Web service URL of the source server  
      rs.Url = "https://<Server Name>/reportserver/ReportService2010.asmx"  
  
      Dim reportName As String = "/SampleReports/Company Sales"  
      Dim reportDefinition As Byte() = Nothing  
  
      Try  
         ' Get the report definition of a report on a source server  
         reportDefinition = rs.GetItemDefinition(reportName)  
         ' Set the base Web service URL of the destination server  
         rs.Url = "https://<Server Name>/reportserver/ReportService2010.asmx"  
         ' Create a copy of the report on the destination server  
         Dim warnings As Warning() = {}  
         rs.CreateCatalogItem("Report", "Company Sales Copy", "/", False, reportDefinition, Nothing, warnings)        
      Catch e As SoapException  
         Console.WriteLine(e.Detail.InnerXml.ToString())  
      End Try  
   End Sub 'Main  
End Class 'Sample  
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 = "https://<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 = "https://<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());   
      }  
   }  
}  

Pour plus d’informations sur la création du proxy de service web initial, consultez Création du proxy du service web.For more information about creating the initial Web service proxy, see Creating the Web Service Proxy.

Voir aussiSee Also

CreateCatalogItem
GetItemDefinition
Création d’applications à l’aide du service web et du .NET Framework Building Applications Using the Web Service and the .NET Framework
Service Web des serveurs de rapportsReport Server Web Service