ReportingService2005.CancelBatch Método
Definición
Importante
Parte de la información hace referencia a la versión preliminar del producto, que puede haberse modificado sustancialmente antes de lanzar la versión definitiva. Microsoft no otorga ninguna garantía, explícita o implícita, con respecto a la información proporcionada aquí.
Cancela el lote que se inició tras una llamada al CreateBatch() método.
public:
void CancelBatch();
public void CancelBatch();
member this.CancelBatch : unit -> unit
Public Sub CancelBatch ()
Ejemplos
Para compilar este ejemplo de código, debes consultar el Reporting Services Web Service Description Language (WSDL) 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 cancela un lote, intenta ejecutarlo y muestra detalles de error:
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 bh As New BatchHeader()
bh.BatchID = rs.CreateBatch()
rs.BatchHeaderValue = bh
rs.CreateFolder("New Folder1", "/", Nothing)
rs.CreateFolder("New Folder2", "/", Nothing)
rs.CreateFolder("New Folder3", "/", Nothing)
Console.WriteLine("Cancelling current batch operation.")
' Cancel the current batch.
Try
rs.CancelBatch()
Catch e As SoapException
Console.WriteLine(e.Detail.InnerXml.ToString())
End Try
Try
' Generates an error because the batch has already been cancelled.
rs.ExecuteBatch()
Console.WriteLine("The batch executed successfully.")
Catch e As SoapException
Console.WriteLine(e.Detail.InnerXml.ToString())
Console.WriteLine("The batch was not executed.")
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()
{
ReportingService rs = new ReportingService2005();
rs.Credentials = System.Net.CredentialCache.DefaultCredentials;
BatchHeader bh = new BatchHeader();
bh.BatchID = rs.CreateBatch();
rs.BatchHeaderValue = bh;
rs.CreateFolder("New Folder1", "/", null);
rs.CreateFolder("New Folder2", "/", null);
rs.CreateFolder("New Folder3", "/", null);
Console.WriteLine("Cancelling current batch operation.");
// Cancel the current batch.
try
{
rs.CancelBatch();
}
catch (SoapException e)
{
Console.WriteLine(e.Detail.InnerXml.ToString());
}
try
{
// Generates an error because the batch has already been cancelled.
rs.ExecuteBatch();
Console.WriteLine("The batch executed successfully.");
}
catch (SoapException e)
{
Console.WriteLine(e.Detail.InnerXml.ToString());
Console.WriteLine("The batch was not executed.");
}
finally
{
rs.BatchHeaderValue = null;
}
}
}
Comentarios
La siguiente tabla muestra la información sobre cabeceras y permisos sobre esta operación.
| Encabezados SOAP | (En) BatchHeaderValue (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). |
Debes especificar el ID del lote que quieres cancelar antes de llamar al CancelBatch método. Puedes hacerlo configurando la BatchHeaderValue propiedad del servicio web del Servidor de Informes a un valor igual al ID del lote que se generó al crear el lote.
Cuando se llama al CancelBatch método, cualquier llamada al método asociada al ID de lote ya no puede ejecutarse. Cualquier intento de ejecutar un lote con un ID de lote cancelado resulta en una excepción SOAP con el código rsBatchNotFoundde error .