Lenguaje

ReportingService2005.CreateBatch Método

Definición

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

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

Devoluciones

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

Ejemplos

Para compilar este ejemplo de código, debes consultar el WSDL de Reporting Services e importar ciertos espacios de nombres. Para más información, consulte Ejemplos de Compilación y Ejecución de Código. El siguiente ejemplo de código crea identificadores de lote para dos nuevos lotes de llamadas a métodos de servicio web y ejecuta 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

La siguiente tabla muestra la información sobre cabeceras y permisos sobre esta operación.

Encabezados SOAP (Fuera) ServerInfoHeaderValue
Permisos necesarios El usuario debe ser un administrador de base de datos o el que esté configurado como la cuenta de ejecución no atendida. Para más información, consulte Cuenta de Ejecución (Modo Nativo SSRS).

El ID devuelto por el CreateBatch método se utiliza para agrupar o agrupar llamadas a métodos de servicio web posteriores. Cada método incluido en el lote debe tener el ID de lote especificado en el encabezado SOAP. Para agrupar las llamadas al método usando el Microsoft .NET Framework, primero debes establecer la BatchHeaderValue propiedad de la clase proxy del servicio Web del Servidor de Informes a un valor igual al de un BatchHeader objeto que contenga un ID de lote previamente creado.

Se aplica a

Consulte también