웹 서비스의 URL 속성 설정Setting the Url Property of the Web Service

MicrosoftMicrosoft .NET Framework.NET Framework 응용 프로그램에서 언제든지 응용 프로그램이 현재 지정된 보고서 서버 웹 서비스의 기준 URL을 수정할 수 있습니다.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. 그러려면 서비스 개체의 Url 속성을 설정하기만 됩니다.To do this, simply set the Url property of the service object. 예를 들어For example:

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";  

다음 예는 한 보고서 서버에서 보고서 정의를 검색하고 이 정의를 사용하여 다른 보고서 서버에 동일한 보고서를 만듭니다.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 = "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());   
      }  
   }  
}  

초기 웹 서비스 프록시를 만드는 방법은 웹 서비스 프록시 만들기를 참조하세요.For more information about creating the initial Web service proxy, see Creating the Web Service Proxy.

관련 항목:See Also

CreateCatalogItemCreateCatalogItem
GetItemDefinitionGetItemDefinition
웹 서비스와 .NET Framework를 사용하여 응용 프로그램 빌드 Building Applications Using the Web Service and the .NET Framework
보고서 서버 웹 서비스Report Server Web Service