Render report in Classic ASP app using Web Services

  • We have a classic ASP web application written in VBScript and need to render a report from Reporting Services using a web service. My problem is that I have never used a web service and can not find any examples on the Internet that show how to render a Reporting Services report via an ASP app. All of the examples I have found use .net. Is it possible to render a report in classic ASP and if so, can you provide me a link to some examples.

    Thanks, I appreciate any help!


    Wendy Schuman

  • Hi Wendy... you can use the Soap Toolkit from ASP to talk directly to the RS ReportService.

    http://www.microsoft.com/downloads/details.aspx?FamilyId=C943C0DD-CEEC-4088-9753-86F052EC8450&displaylang=en

    Take note of the fact that MSFT will be ending support for this tool in the near future.

    There are also some other ways you can render a report. For example, you can use the XmlHttp object to request a rendered report using the URL access method, like this:

    Set oHTTP = Server.CreateObject("Msxml2.XMLHTTP.3.0")

    oHTTP.Open "GET", "http://server/ReportServer?%2ReportName&rs%3aCommand=Render", False

    oHTTP.Send

    Response.BinaryWrite oHTTP.ResponseBody

    Or, you can just put the URL to the report directly into an anchor tag and call it like you would any other hyperlink.

    Best,

    -Chris

  • Hi Chris,

    Thanks for your response. I did get the URL method to work, but my boss does not want to use that method.  I downloaded the SOAP toolkit and have been trying to implement that. Now, I am receving the following error when calling the Reporting Services render method:

    Error Type:

    Client (0x80070057)

    Client:Incorrect number of parameters supplied for SOAP request HRESULT=0x80070057: The parameter is incorrect. - Client:Unspecified client error. HRESULT=0x80070057: The parameter is incorrect.

    The render mthod in the wsdl file has seven parameters and that's what I'm passing. Does anyone know what's missing here? Here is my calling code:

    Set SoapClient = CreateObject("MSSOAP.SoapClient30")

    SoapClient.ClientProperty("ServerHTTPRequest") = True

    SoapClient.mssoapinit "http://localhost/reportserver/reportservice.asmx?wsdl", "", "", ""

    Dim Report

    Dim Format

    Dim HistoryID

    Dim DeviceInfo

    Dim ReportParam(1)

    Dim Credentials

    Dim ShowHideToggle

    Report = "AWReporter/Customer Orders"

    Format = "PDF"

    HistoryID = null

    DeviceInfo = null

    ReportParam(0) = 549

    Credentials = null

    ShowHideToggle = null

    ReportResult = SoapClient.Render (Report, Format, HistoryID, DeviceInfo, ReportParam, Credentials, ShowHideToggle )


    Wendy Schuman

  • Well, I figured out the parameters error. I needed to pass in the parameters for the RenderResponse method as well. Now, I'm getting SoapMapper errors. I guess I'm getting somewhere.


    Wendy Schuman

  • I ended up contacting Microsoft about getting the Reporting Services web service to work with classic ASP and the Microsoft SOAP toolkit. After a few conversations and some testing on their part,  they couldn't get it either. The errors are occuring because of the complex types in the Render method. They did come up with another solution that I haven't tried yet, but I thought I would post so others could try as well if they are experienceing the same issues.

    Hi Wendy,

    As I had mentioned in our phone conversation, I am sending you the details on using a .Net client to access the webservice and using the results in your ASP application. This can be done by using CCW (com-callable wrapper).

     Simple code would be to,

    1. Create a class library using VC# or VB.Net

    2. Create a class with a web reference to the webservice.

    3. Add code to call the webservice.

    4. Set the COM Interop setting to TRUE

    -For C#, go to Project Properties - Configuration properties - Build - Under Outputs - Set "Register for COM Interop" to true.

    -For VB.Net, go to Project Properties - Configuration properties - Build - Select "Register for COM Interop" and check to enable.

    Now, you can call this .net assembly from any COM client (ASP, VB6 etc.) like you would call any COM component.

    Please refer the following links which talk about CCW in detail.

    http://msdn.microsoft.com/library/en-us/cpguide/html/cpconsimulatingcominterfaces.asp

    http://msdn.microsoft.com/library/en-us/dnwebsrv/html/intwebsvccom.asp?frame=true

    817248 HOW TO: Call Visual Basic .NET Assembly from Visual Basic 6.0 and Call

    http://support.microsoft.com/?id=817248

     315682 How To: Install an Assembly in the Global Assembly Cache in Visual Basic

    http://support.microsoft.com/?id=315682

     I am attaching complete VC#.Net sample to this email.

    Please note that this necessitates .Net framework to be installed on the machine where the CCW wrapped .Net code will run (same machine as the ASP server).

     Please let me know if this would be a viable solution for you.

     Thanks,

    Abhuday


    Wendy Schuman

Viewing 5 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply