Share via


ReportExecutionService.Render Method

特定のレポートを処理し、指定した形式で表示します。

名前空間: Microsoft.WSSUX.ReportingServicesWebService.RSExecutionService2005
アセンブリ: ReportExecution2005 (reportexecutionservice.dll 内)

構文

'宣言
<SoapDocumentMethodAttribute("https://schemas.microsoft.com/sqlserver/2005/06/30/reporting/reportingservices/Render", RequestNamespace:="https://schemas.microsoft.com/sqlserver/2005/06/30/reporting/reportingservices", ResponseNamespace:="https://schemas.microsoft.com/sqlserver/2005/06/30/reporting/reportingservices", Use:=SoapBindingUse.Literal, ParameterStyle:=SoapParameterStyle.Wrapped)> _
<SoapHeaderAttribute("ServerInfoHeaderValue", Direction:=SoapHeaderDirection.Out)> _
<SoapHeaderAttribute("ExecutionHeaderValue")> _
Public Function Render ( _
    Format As String, _
    DeviceInfo As String, _
    <OutAttribute> ByRef Extension As String, _
    <OutAttribute> ByRef MimeType As String, _
    <OutAttribute> ByRef Encoding As String, _
    <OutAttribute> ByRef Warnings As Warning(), _
    <OutAttribute> ByRef StreamIds As String() _
) As Byte()
[SoapDocumentMethodAttribute("https://schemas.microsoft.com/sqlserver/2005/06/30/reporting/reportingservices/Render", RequestNamespace="https://schemas.microsoft.com/sqlserver/2005/06/30/reporting/reportingservices", ResponseNamespace="https://schemas.microsoft.com/sqlserver/2005/06/30/reporting/reportingservices", Use=SoapBindingUse.Literal, ParameterStyle=SoapParameterStyle.Wrapped)] 
[SoapHeaderAttribute("ServerInfoHeaderValue", Direction=SoapHeaderDirection.Out)] 
[SoapHeaderAttribute("ExecutionHeaderValue")] 
public byte[] Render (
    string Format,
    string DeviceInfo,
    out string Extension,
    out string MimeType,
    out string Encoding,
    out Warning[] Warnings,
    out string[] StreamIds
)
[SoapDocumentMethodAttribute(L"https://schemas.microsoft.com/sqlserver/2005/06/30/reporting/reportingservices/Render", RequestNamespace=L"https://schemas.microsoft.com/sqlserver/2005/06/30/reporting/reportingservices", ResponseNamespace=L"https://schemas.microsoft.com/sqlserver/2005/06/30/reporting/reportingservices", Use=SoapBindingUse::Literal, ParameterStyle=SoapParameterStyle::Wrapped)] 
[SoapHeaderAttribute(L"ServerInfoHeaderValue", Direction=SoapHeaderDirection::Out)] 
[SoapHeaderAttribute(L"ExecutionHeaderValue")] 
public:
array<unsigned char>^ Render (
    String^ Format, 
    String^ DeviceInfo, 
    [OutAttribute] String^% Extension, 
    [OutAttribute] String^% MimeType, 
    [OutAttribute] String^% Encoding, 
    [OutAttribute] array<Warning^>^% Warnings, 
    [OutAttribute] array<String^>^% StreamIds
)
/** @attribute SoapDocumentMethodAttribute("https://schemas.microsoft.com/sqlserver/2005/06/30/reporting/reportingservices/Render", RequestNamespace="https://schemas.microsoft.com/sqlserver/2005/06/30/reporting/reportingservices", ResponseNamespace="https://schemas.microsoft.com/sqlserver/2005/06/30/reporting/reportingservices", Use=SoapBindingUse.Literal, ParameterStyle=SoapParameterStyle.Wrapped) */ 
/** @attribute SoapHeaderAttribute("ServerInfoHeaderValue", Direction=SoapHeaderDirection.Out) */ 
/** @attribute SoapHeaderAttribute("ExecutionHeaderValue") */ 
public byte[] Render (
    String Format, 
    String DeviceInfo, 
    /** @attribute OutAttribute() */ /** @ref */ String Extension, 
    /** @attribute OutAttribute() */ /** @ref */ String MimeType, 
    /** @attribute OutAttribute() */ /** @ref */ String Encoding, 
    /** @attribute OutAttribute() */ /** @ref */ Warning[] Warnings, 
    /** @attribute OutAttribute() */ /** @ref */ String[] StreamIds
)
JScript は、値と型の引数の参照渡しをサポートしていません。

パラメータ

  • Format
    レポートを表示する形式です。この引数は、表示拡張機能にマップされます。サポートされる拡張機能には、XML、NULL、CSV、IMAGE、PDF、HTML4.0、HTML3.2、MHTML、EXCEL、HTMLOWC があります。サポートされる拡張機能の一覧は、ListRenderingExtensions メソッドを呼び出すことによって取得できます。
  • DeviceInfo
    Format パラメータで指定する表示拡張機能に必要なデバイス固有のコンテンツを含む XML 文字列です。DeviceInfo 設定は、DeviceInfo XML 要素の内部要素として渡す必要があります。特定の出力形式に対応するデバイス情報設定の詳細については、「Reporting Services デバイス情報設定」を参照してください。
  • Extension
    [out] 出力ストリームに対応するファイル拡張子です。
  • MimeType
    [out] 表示されるレポートの MIME の種類です。
  • Encoding
    [out] レポート サーバーがレポートのコンテンツの表示に使用するエンコードです。
  • Warnings
    [out] レポート処理中に発生したすべての警告を表す Warning オブジェクトの配列です。
  • StreamIds
    [out] ストリーム ID です。これらの ID は RenderStream メソッドに渡されます。特定のレポートに関連付けられた外部リソース (画像など) を表示するために使用できます。

戻り値

指定された形式でのレポートの Byte[] 配列です。

解説

Render は、ExecutionInfo ヘッダーに示されるレポート実行に関連付けられた処理済みのレポートを表示します。セッション スナップショットがまったく存在しない場合、(資格情報とパラメータの要件がすべて満たされる限り) このメソッドはレポートを実行し、新しいセッション スナップショットが作成されます。非クエリのパラメータ値が変更されたためにレポートを再処理する必要がある場合は、スナップショットが再処理されます。

実行オプションがキャッシュまたは実行スナップショットに設定されている場合、Render への呼び出しは既存のスナップショットを使用します。

レポートをキャッシュする設定になっていて、指定したパラメータ値と資格情報が一致する場合、実際にレポートを処理する代わりに、キャッシュされたスナップショットのコピーが読み込まれる可能性があります。

資格情報とパラメータの要件が満たされない場合、このメソッドはエラーを返します。

表示拡張機能で複数ページの指定をサポートしている場合は、この後の Render への呼び出しを使用して、レポートの追加のページをフェッチすることができます。

出力をストリームにできないという表示方法の制約があるため、ファイル全体をメモリ内に保存する必要があります。

レポートの読み込みと表示に必要な手順の説明など、実行のライフ サイクルの詳細については、「実行状態の識別」を参照してください。

使用例

次のコード例をコンパイルするには、Reporting Services の WSDL を参照し、特定の名前空間をインポートする必要があります。詳細については、「コード例のコンパイルと実行」を参照してください。次のコード例では、MHTML 形式のレポートを表示し、.mht ファイルとしてディスクに保存します。

Imports System
Imports System.IO
Imports System.Web.Services.Protocols
Imports myNamespace.MyReferenceName

Class Sample
    Public Shared Sub Main()
        Dim rs As New ReportExecutionService()
        rs.Credentials = System.Net.CredentialCache.DefaultCredentials
        rs.Url = "http://myserver/reportserver/ReportExecution2005.asmx"

        ' Render arguments
        Dim result As Byte() = Nothing
        Dim reportPath As String = "/AdventureWorks Sample Reports/Employee Sales Summary "
        Dim format As String = "MHTML"
        Dim historyID As String = Nothing
        Dim devInfo As String = "<DeviceInfo><Toolbar>False</Toolbar></DeviceInfo>"

        ' Prepare report parameter.
        Dim parameters(2) As ParameterValue

        parameters(0) = New ParameterValue()
        parameters(0).Name = "EmpID"
        parameters(0).Value = "288"
        parameters(1) = New ParameterValue()
        parameters(1).Name = "ReportMonth"
        parameters(1).Value = "6" ' June
        parameters(2) = New ParameterValue()
        parameters(2).Name = "ReportYear"
        parameters(2).Value = "2004"

        Dim credentials As DataSourceCredentials() = Nothing
        Dim showHideToggle As String = Nothing
        Dim encoding As String = ""
        Dim mimeType As String = ""
        Dim warnings As Warning() = Nothing
        Dim reportHistoryParameters As ParameterValue() = Nothing
        Dim streamIDs As String() = Nothing

        Dim execInfo As New ExecutionInfo
        Dim execHeader As New ExecutionHeader()
        Dim SessionId As String
        Dim extension As String = ""

        rs.ExecutionHeaderValue = execHeader

        execInfo = rs.LoadReport(reportPath, historyID)

        rs.SetExecutionParameters(parameters, "en-us")

        SessionId = rs.ExecutionHeaderValue.ExecutionID
        Console.WriteLine("SessionID: {0}", rs.ExecutionHeaderValue.ExecutionID)


        Try
            result = rs.Render(format, devInfo, extension, _
               encoding, mimeType, warnings, streamIDs)

            execInfo = rs.GetExecutionInfo()

            Console.WriteLine("Execution date and time: {0}", execInfo.ExecutionDateTime)


        Catch e As SoapException
            Console.WriteLine(e.Detail.OuterXml)
        End Try

        ' Write the contents of the report to an MHTML file.
        Try
            Dim stream As FileStream = File.Create("report.mht", result.Length)
            Console.WriteLine("File created.")
            stream.Write(result, 0, result.Length)
            Console.WriteLine("Result written to the file.")
            stream.Close()
        Catch e As Exception
            Console.WriteLine(e.Message)
        End Try
    End Sub 'Main
End Class
using System;
using System.IO;
using System.Web.Services.Protocols;
using myNamespace.MyReferenceName;

class Sample
{
    static void Main(string[] args)
    {
        ReportExecutionService rs = new ReportExecutionService();
        rs.Credentials = System.Net.CredentialCache.DefaultCredentials;
        rs.Url = "http://myserver/reportserver/ReportExecution2005.asmx";

        // Render arguments
        byte[] result = null;
        string reportPath = "/AdventureWorks Sample Reports/Employee Sales Summary";
        string format = "MHTML";
        string historyID = null;
        string devInfo = @"<DeviceInfo><Toolbar>False</Toolbar></DeviceInfo>";

        // Prepare report parameter.
        ParameterValue[] parameters = new ParameterValue[3];
        parameters[0] = new ParameterValue();
        parameters[0].Name = "EmpID";
        parameters[0].Value = "288";
        parameters[1] = new ParameterValue();
        parameters[1].Name = "ReportMonth";
        parameters[1].Value = "6"; // June
        parameters[2] = new ParameterValue();
        parameters[2].Name = "ReportYear";
        parameters[2].Value = "2004";

        DataSourceCredentials[] credentials = null;
        string showHideToggle = null;
        string encoding;
        string mimeType;
        string extension;
        Warning[] warnings = null;
        ParameterValue[] reportHistoryParameters = null;
        string[] streamIDs = null;
        
        ExecutionInfo execInfo = new ExecutionInfo();
        ExecutionHeader execHeader = new ExecutionHeader();

        rs.ExecutionHeaderValue = execHeader;

        execInfo = rs.LoadReport(reportPath, historyID);

        rs.SetExecutionParameters(parameters, "en-us"); 
        String SessionId = rs.ExecutionHeaderValue.ExecutionID;

        Console.WriteLine("SessionID: {0}", rs.ExecutionHeaderValue.ExecutionID);


        try
        {
            result = rs.Render(format, devInfo, out extension, out encoding, out mimeType, out warnings, out streamIDs);

            execInfo = rs.GetExecutionInfo();

            Console.WriteLine("Execution date and time: {0}", execInfo.ExecutionDateTime);


        }
        catch (SoapException e)
        {
            Console.WriteLine(e.Detail.OuterXml);
        }
        // Write the contents of the report to an MHTML file.
        try
        {
            FileStream stream = File.Create("report.mht", result.Length);
            Console.WriteLine("File created.");
            stream.Write(result, 0, result.Length);
            Console.WriteLine("Result written to the file.");
            stream.Close();
        }
        catch (Exception e)
        {
            Console.WriteLine(e.Message);
        }

    }
}

スレッド セーフ

この型の public static (Microsoft Visual Basic では共有 ) メンバは、スレッド セーフです。インスタンス メンバの場合は、スレッド セーフであるとは限りません。

プラットフォーム

開発プラットフォーム

サポートされているプラットフォームの一覧については、「SQL Server 2005 のインストールに必要なハードウェアおよびソフトウェア」を参照してください。

対象プラットフォーム

サポートされているプラットフォームの一覧については、「SQL Server 2005 のインストールに必要なハードウェアおよびソフトウェア」を参照してください。

参照

関連項目

ReportExecutionService Class
ReportExecutionService Members
Microsoft.WSSUX.ReportingServicesWebService.RSExecutionService2005 Namespace