Export (0) Print
Expand All

Batching Methods

The use of SOAP headers in Reporting Services enables you to include multiple Web service methods in a single operation. Methods run within the scope of a single database transaction, in the order in which they are called.

Rollback is one advantage of using multiple-method batch operations. If an error occurs on any of the method calls while a batch is running, the report server stops running the batch and rolls back any previous operations. This is useful when a method call depends on the successful completion of other method calls in that batch.

The Web service does not provide locking semantics for multiple-method batch operations. Rows in the report server database are not locked for updating until the message is sent to the server and the Execute command is called.

There are also no concurrency controls to guarantee that the database has not changed since the data was last read. If two clients modify the same item, the last update succeeds if the parameters are still valid (for example, the item has not been renamed).

The following example calls the CreateFolder method three times and runs these calls as a single batch. If any of the calls to CreateFolder fail, the entire batch is canceled.

using System;
using System.Web.Services.Protocols; 
using myNamespace.MyReferenceName;


class Sample
{
    static void Main(string[] args)
    {
        ReportingService2005 rs = new ReportingService2005();
        rs.Credentials = System.Net.CredentialCache.DefaultCredentials;
      // Set the base Web service URL of the source server
      rs.Url = "http://servername/reportserver/ReportService2005.asmx"

        BatchHeader bh = new BatchHeader();

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

        Console.WriteLine("Creating folders...");
        rs.BatchHeaderValue = bh1;
        rs.ExecuteBatch();
        Console.WriteLine("Folders created successfully.");

        rs.BatchHeaderValue = null;
    }
}

Community Additions

ADD
Show:
© 2014 Microsoft