Aracılığıyla paylaş


Web hizmeti Url özelliği ayarlama

Her zaman senin Microsoft  .NET Frameworkuygulamaları için uygulama şu anda yönlendirilir Report Server Web hizmetini temel URL'sini değiştirebilir. Bunu yapmak için sadece set Url hizmet nesnesinin özelliği. Örneğin:

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

Aşağıdaki örnek, bir rapor sunucudan Rapor tanımı alır ve farklı rapor sunucusunda özdeş bir rapor oluşturmak için bu tanım kullanır:

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 = "http://<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 = "http://<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
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 = "http://<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 = "http://<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 = "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()); 
      }
   }
}
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()); 
      }
   }
}

İlk Web hizmeti proxy oluşturma hakkında daha fazla bilgi için bkz: Web Hizmeti Proxy oluşturma.

Ayrıca bkz.

Başvuru

CreateCatalogItem

GetItemDefinition

Kavramlar

Rapor sunucusu Web hizmeti

Diğer Kaynaklar

Web hizmeti kullanarak uygulamaları oluşturma ve.net Framework