ReportingService2005.CreateBatch Método

Definición

Crea un lote que ejecuta varios métodos dentro de una única transacción.

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

Devoluciones

Valor String que identifica de forma única una operación por lotes.

Ejemplos

Para compilar este ejemplo de código, debe hacer referencia al Reporting Services WSDL e importar determinados espacios de nombres. Para obtener más información, vea Compilar y ejecutar ejemplos de código. En el ejemplo de código siguiente se crean identificadores por lotes para dos nuevos lotes de llamadas al método de servicio web y se ejecutan los lotes:

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

Comentarios

En la siguiente tabla se muestra la información de encabezado y de permisos de esta operación.

Encabezados SOAP (Out) ServerInfoHeaderValue
Permisos necesarios El usuario debe ser un administrador de base de datos o el configurado como la cuenta de ejecución desatendida. Para obtener más información, vea Cuenta de ejecución (modo nativo de SSRS) .

El identificador devuelto por el CreateBatch método se usa para agrupar o procesar por lotes llamadas a métodos de servicio web posteriores. Cada método incluido en el lote debe tener el identificador de lote especificado en el encabezado SOAP. Para procesar por lotes las llamadas de método mediante Microsoft .NET Framework, primero debe establecer la BatchHeaderValue propiedad de la clase proxy del servicio web del servidor de informes en un valor igual al de un BatchHeader objeto que contiene un identificador de lote creado anteriormente.

Se aplica a

Consulte también