Russell Asher
Russell Asher

Reputation: 195

Accessing specfic parts of a SSRS report using soap?

We have a test WCF client hooked up to our application that parses xml from a report and displays it in a custom table. We have cells that we want to be able to collapse for a list of unique ID's initially viable on the table. The problem is their is too much data and I was wondering if there is a way to only load the id's at first from the report and then dynamically call for the extra information when the ID is clicked on. This way we would load far less data at the start of the app.

I thought I might be able to do this with the soap request for the report but I really don't understand how im supposed to figure out their API. This was done by someone else from the past for our WCF application. I thought maybe adding to this could get me only a certain part of the table? Maybe I am totally wrong in the way im approaching this.

public string Invoke(string reportPath, FilterViewModel reportParameter, NetworkCredential networkCredential)
{
    if (NetworkInterface.GetIsNetworkAvailable())
    {
        m_NetworkCredential = networkCredential;
        m_reportParameter = reportParameter;

        Dictionary<string, string> headers = new Dictionary<string, tring>();
        headers.Add("charset", "utf-8");
        headers.Add("useUnsafeHeaderParsing", "true");
        headers.Add("SOAPAction", "http://schemas.microsoft.com/sqlserver/2005/06/30/reporting/reportingservices/LoadReport");

        StringBuilder reqSOAPEnv = new StringBuilder();

        reqSOAPEnv.Append("<s:Envelope xmlns:s='http://schemas.xmlsoap.org/soap/envelope/'>");

        reqSOAPEnv.Append("<s:Body xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' ");
        reqSOAPEnv.Append("xmlns:xsd='http://www.w3.org/2001/XMLSchema'>");

        reqSOAPEnv.Append("<LoadReport xmlns='http://schemas.microsoft.com/sqlserver/2005/06/30/reporting/reportingservices'>");
        reqSOAPEnv.Append("<Report>");
        reqSOAPEnv.Append(reportPath);
        reqSOAPEnv.Append("</Report>");
        reqSOAPEnv.Append("</LoadReport>");

        reqSOAPEnv.Append("</s:Body>");
        reqSOAPEnv.Append("</s:Envelope>");

        SSRS_ServiceRequestController serviceRequest = new SSRS_ServiceRequestController();
        result = serviceRequest.MakeWebRequest(ServiceURL, m_ContentType, m_Method, headers, networkCredential, reqSOAPEnv.ToString());
    }
    return result;
}

Upvotes: 0

Views: 301

Answers (1)

Jeroen
Jeroen

Reputation: 63760

Have you looked at the SSRS Web Service documentation yet? As far as I know there's no method in the SOAP API to get a part of a report.

One workaround may be to render the report to XML, and process that XML to retrieve only the data you need. Another one may be to use a sub-report for the table you want to export, and only use the sub-report itself for your situation.

By the way, I understand you've inherited the code you posted, but it looks a bit off. Why is the SOAP request constructed as a string? It's probably a lot easier if you generate a proxy for the SSRS Web Service, and just use regular method calls - let the framework handle the SOAP stuff for you.

Upvotes: 1

Related Questions