ReportingService2005.CreateBatch Método

Definição

Cria um lote que executa múltiplos métodos dentro de uma única transação.

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

Retornos

A String que identifica de forma única uma operação em lote.

Exemplos

Para compilar esse exemplo de código, você deve consultar o Reporting Services WSDL e importar certos namespaces. Para mais informações, veja Exemplos de Código Compilando e Executando. O exemplo de código a seguir cria IDs de lote para dois novos lotes de chamadas de métodos de serviço Web e executa os 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;  
      }  
   }  
}  

Comentários

A tabela abaixo mostra informações sobre cabeçalhos e permissões sobre esta operação.

Cabeçalhos SOAP (Fora) ServerInfoHeaderValue
Permissões necessárias O usuário deve ser um administrador de banco de dados ou aquele configurado como conta de execução não atendida. Para mais informações, veja Conta de Execução (Modo Nativo SSRS).

O ID devolvido pelo CreateBatch método é usado para agrupar ou lotar chamadas subsequentes de métodos de serviço Web. Cada método incluído no lote deve ter o ID do lote especificado no cabeçalho SOAP. Para batch as chamadas de método usando o Microsoft .NET Framework, você deve primeiro definir a BatchHeaderValue propriedade da classe proxy do serviço Web do Report Server para um valor igual ao de um BatchHeader objeto que contenha um ID de lote previamente criado.

Aplica-se a

Confira também