ReportingService2005.CreateBatch Method

Definition

创建在单个事务内执行多个方法的批处理。Creates a batch that executes multiple methods within a single transaction.

public:
 System::String ^ CreateBatch();
public string CreateBatch ();
member this.CreateBatch : unit -> string
Public Function CreateBatch () As String

Returns

String

一个唯一标识批处理操作的StringA String that uniquely identifies a batch operation.

Examples

若要编译此代码示例,必须引用 Reporting Services WSDL 并导入某些命名空间。To compile this code example, you must reference the Reporting Services WSDL and import certain namespaces. 有关详细信息,请参阅 编译和运行代码示例For more information, see Compiling and Running Code Examples. 下面的代码示例创建两个新的 Web 服务方法调用批的批处理 Id 并执行批处理:The following code example creates batch IDs for two new batches of Web service method calls and executes the batches:

Imports System  
Imports System.Web.Services.Protocols  

Class Sample  
   Public Shared Sub Main()  
      Dim rs As New ReportingService2005()  
      rs.Credentials = System.Net.CredentialCache.DefaultCredentials  

      Dim bh1 As New BatchHeader()  
      Dim bh2 As New BatchHeader()  

      bh1.BatchID = rs.CreateBatch()  
      rs.BatchHeaderValue = bh1  
      rs.CreateFolder("New Folder1", "/", Nothing)  
      rs.CreateFolder("New Folder2", "/", Nothing)  
      rs.CreateFolder("New Folder3", "/", Nothing)  

      bh2.BatchID = rs.CreateBatch()  
      rs.BatchHeaderValue = bh2  
      rs.DeleteItem("/New Folder1")  
      rs.DeleteItem("/New Folder2")  
      rs.DeleteItem("/New Folder3")  

      rs.BatchHeaderValue = bh1  

      ' Create folders using a batch header 1.  
      Try  
         rs.ExecuteBatch()  
         Console.WriteLine("Folders created successfully.")  

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

      rs.BatchHeaderValue = bh2  

      ' Delete folders using batch header 2.  
      Try  
         rs.ExecuteBatch()  
         Console.WriteLine("Folders deleted successfully.")  

      Catch e As SoapException  
         Console.WriteLine(e.Detail.InnerXml.ToString())  

      Finally  
         rs.BatchHeaderValue = Nothing  
      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;  

      BatchHeader bh1 = new BatchHeader();  
      BatchHeader bh2 = new BatchHeader();  

      bh1.BatchID = rs.CreateBatch();  
      rs.BatchHeaderValue = bh1;  
      rs.CreateFolder("New Folder1", "/", null);  
      rs.CreateFolder("New Folder2", "/", null);  
      rs.CreateFolder("New Folder3", "/", null);  

      bh2.BatchID = rs.CreateBatch();  
      rs.BatchHeaderValue = bh2;  
      rs.DeleteItem("/New Folder1");  
      rs.DeleteItem("/New Folder2");  
      rs.DeleteItem("/New Folder3");  

      rs.BatchHeaderValue = bh1;  

      // Create folders using a batch header 1.  
      try  
      {  
         rs.ExecuteBatch();  
         Console.WriteLine("Folders created successfully.");  
      }  

      catch (SoapException e)  
      {  
         Console.WriteLine(e.Detail.InnerXml.ToString());  
      }  

      rs.BatchHeaderValue = bh2;  

      // Delete folders using batch header 2.  
      try  
      {  
         rs.ExecuteBatch();  
         Console.WriteLine("Folders deleted successfully.");  
      }  

      catch (SoapException e)  
      {  
         Console.WriteLine(e.Detail.InnerXml.ToString());  
      }  

      finally  
      {  
         rs.BatchHeaderValue = null;  
      }  
   }  
}  

Remarks

下表显示了有关此操作的标头和权限信息。The table below shows header and permissions information on this operation.

SOAP 标头SOAP Headers (Out) ServerInfoHeaderValue(Out) ServerInfoHeaderValue
所需的权限Required Permissions 用户必须是数据库管理员或配置为无人参与的执行帐户。The user must be a database administrator or the one configured as the unattended execution account. 有关详细信息,请参阅 执行帐户 (SSRS 本机模式) For more information, see Execution Account (SSRS Native Mode).

方法返回的 ID CreateBatch 用于对后续的 Web 服务方法调用进行分组或批处理。The ID returned by the CreateBatch method is used to group or batch subsequent Web service method calls. 批处理中包含的每个方法都必须具有在 SOAP 标头中指定的批处理 ID。Each method included in the batch must have the batch ID specified in the SOAP header. 若要使用 Microsoft .NET 框架对方法调用进行批处理,必须首先将 BatchHeaderValue 报表服务器 Web 服务代理类的属性设置为一个值,该值等于 BatchHeader 包含以前创建的批 ID 的对象的值。To batch the method calls using the Microsoft .NET Framework, you must first set the BatchHeaderValue property of the Report Server Web service proxy class to a value that is equal to that of a BatchHeader object that contains a previously created batch ID.

Applies to

See also