Ustawienie właściwość adresu URL usługa sieci Web
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.Aby to zrobić, po prostu zestaw Adres URL właściwość obiektu usługa.Na przykład:
Dim rs As New ReportingService2005()
rs.Credentials = System.Net.CredentialCache.DefaultCredentials
rs.Url = "http://<Server Name>/reportserver/ReportService2005.asmx"
ReportingService service = new ReportingService();
rs.Credentials = System.Net.CredentialCache.DefaultCredentials;
rs.Url = "http://<Server Name>/reportserver/ReportService2005.asmx";
Poniższy przykład pobiera definicja raportu z jednego serwer raportów i używa tej definicji do utworzenia raportu o identycznych na serwerze innego raportu:
Imports System
Imports System.Web.Services.Protocols
Class Sample
Public Shared Sub Main()
Dim rs As New ReportingService2005()
rs.Credentials = System.Net.CredentialCache.DefaultCredentials
' Set the base Web service URL of the source server
rs.Url = "http://<Server Name>/reportserver/ReportService2005.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.GetReportDefinition(reportName)
' Set the base Web service URL of the destination server
rs.Url = "http://<Server Name>/reportserver/ReportService2005.asmx"
' Create a copy of the report on the destination server
rs.CreateReport("Company Sales Copy", "/", False, reportDefinition, Nothing)
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()
{
ReportingService2005 rs = new ReportingService2005();
rs.Credentials = System.Net.CredentialCache.DefaultCredentials;
// Set the base Web service URL of the source server
rs.Url = "http://<Server Name>/reportserver/reportservice2005.asmx";
string reportName = "/SampleReports/Company Sales";
byte[] reportDefinition = null;
try
{
reportDefinition = rs.GetReportDefinition(reportName);
// Set the base Web service URL of the destination server
rs.Url = "http://<Server Name>/reportserver/ReportService2005.asmx";
// Create a copy of the report on the destination server
rs.CreateReport("Company Sales Copy", "/", false, reportDefinition, null);
}
catch (SoapException e)
{
Console.WriteLine(e.Detail.InnerXml.ToString());
}
}
}
Aby uzyskać więcej informacji na temat tworzenia początkowego serwera proxy usługa sieci Web zobacz Tworzenie serwera proxy usługa sieci Web.
See Also
Reference
CreateReport(String, String, Boolean, array<Byte[], array<Property[])
GetReportDefinition(String)