How to run a report from WCF

hi,
I am trying to run a report from a WCF service application, and then render it in PDF Format to a caller WPF application. But I cant get it! In more detail, this is what my app should do
1. from WPF, call a web service procedure, pass a report name, report path and parameters. Report is store at the same server where Web Service is installed
2. WCF procedure loads report, set parameters, retrieve data from DB and renders it as an array of bytes
3. WPF gets the array, save it into a PDF file, then open it.
this is the code of the WCF procedure.
    Function DownloadCRReport(codEnte As String, connString As String, reportDir As String, reportName As String, Parameters As Dictionary(Of String, Object)) As Byte() Implements IGesiService.DownloadCRReport
        Try
            Dim bytes As Byte()
            Dim infile As BinaryReader
            Dim fs As FileStream
            Dim rep As New ReportDocument
            Dim RepAddress As String
            logPath = reportDir & "log\"
            sb = New StringBuilder()
            timestamp = Now.Year.ToString & Now.Month.ToString & Now.Day.ToString & Now.Hour.ToString & Now.Minute.ToString & Now.Second.ToString
            logFileName = timestamp & "_" & reportName & ".txt"
            logFile = New StreamWriter(logPath & logFileName, FileMode.CreateNew)
            logFile.WriteLine("----
Date and time: " & Now.ToString & " -
            If My.Computer.FileSystem.FileExists(reportDir & reportName & ".rpt") = False Then
                Throw New Exception("file RPT non found in: " & reportDir)
            End If
            RepAddress = reportDir & reportName & ".rpt"
            logFile.WriteLine("rep address: " & RepAddress)
            rep.Load(RepAddress, OpenReportMethod.OpenReportByDefault)
            logFile.WriteLine("load rep")
            If rep.DataSourceConnections.Count > 0 Then
                rep.DataSourceConnections.Item(0).SetLogon("usr", "pwd")
                logFile.WriteLine("data source connection")
            End If
            For Each i In Parameters
                rep.SetParameterValue(i.Key, i.Value)
                logFile.WriteLine("param: " & i.Key & " - " & i.Value)
            Next
            Try
                fs = rep.ExportToStream(ExportFormatType.PortableDocFormat)
                logFile.WriteLine("export to stream")
                infile = New BinaryReader(fs)
                logFile.WriteLine("created binaryreader")
                bytes = infile.ReadBytes(CInt(fs.Length))
                logFile.WriteLine("render pdf. fine")
                logFile.Close()
                Return bytes
            Catch ex As Exception
                logFile.WriteLine("vbCrLf & ex.Message & vbCrLf & ex.InnerException.Message)
                logFile.Close()
                Return Nothing
            End Try
        Catch ex As Exception
            logFile.WriteLine("vbCrLf & ex.Message & "-" & vbCrLf & ex.InnerException.Message)
            logFile.Close()
            Return Nothing
        End Try
    End Function
I detected that error occurs on rep.ExportToStream(ExportFormatType.PortableDocFormat). I should point out that the same procedure works under WPF application. In the WCF server I installed CR Runtime engine for .NET framework (13.0.9.1312) and CR version for Microsoft Visual Studio (same version). Moreover, all DB operations are stored into the report, so I should not pass any dataset, just parameters.
Anyway, just to begin, I tried to call a simple report with just two string parameters and no queries, but I alwais get error ("An exception of type 'System.NullReferenceException' occurred in MyApp... Object reference not set to an instance of an object)!
How can I make it work? thanks for help

hi Ludek,
Im trying to change DB connection info at runtime for all of the report tables. this is the code I used in my Web Service
          Function DownloadCRReport(...)
If rep.DataSourceConnections.Count > 0 Then
   Dim conn As New ConnectionInfo
   Dim tabLogon As TableLogOnInfo
   conn.ServerName = "10.10.15.90" 'IP address of DB server
   conn.DatabaseName = "MyDB"   'Database name as set in TNSNAMES.ORA
   conn.UserID = "newuser"
   conn.Password = "newpwd"
   For Each t As Table In rep.Database.Tables
      tabLogon = t.LogOnInfo
      tabLogon.ConnectionInfo = conn
      t.ApplyLogOnInfo(tabLogon)
      logFile.WriteLine("changed logon tab. " & t.Name)
   Next
   rep.Refresh()
   logFile.WriteLine("changed data source connection")
End If
'set parameters
If Not IsNothing(Parameters) Then
   For Each i In Parameters
      rep.SetParameterValue(i.Key, i.Value)
      logFile.WriteLine("set parameter" & i.Key & " - " & i.Value)
   Next
End If
fs = rep.ExportToStream(ExportFormatType.PortableDocFormat)
          End Function
that comes to an error on rep.ExportToStream: "Unable to access database".
Running web service in debug mode, I noticed that, after t.ApplyLogonInfo(tabLogon), the new ConnectionInfo has "password" property empty. Maybe this could cause the error, or is there some mistake in the new connectioninfo?

Similar Messages

  • How to run a report from oracle 10g form in .csv format

    dear all,
    how to run a report from oracle 10g form in .csv format? i've already run in pdf & excel format.
    i'm using
    SET_REPORT_OBJECT_PROPERTY (ro_report_id, report_desformat, 'PDF'); --for pdf
    SET_REPORT_OBJECT_PROPERTY (ro_report_id, report_desformat, 'SPREADSHEET'); ---for excel
    Please Help..

    i have already tried.
    but the report show in htm or html format. that file will not save into csv. please help.

  • How to run a report from UIX ?

    Hi, I need to run my reports made in Oracle Reports Builder, in Web Style. All reports has parameters, then I buid a UIX page with some MessageChoice to select values for the parameters, and I need to invoke the report when a click the submit button. How I can call this JSP, because to work I need to invoke a URL not the JSP code. Example:
    http://localhost:8889/reports/myreport.jsp?cia=001
    Thanks.

    Rodrigo,
    We figured out the way to run the reports from UIX parameter forms. It will take a lot of explainig though. If you are interested, please email me at gorbunov @ pacbell . net and I'll send you the example.
    Regards,
    igor

  • How to Run Oracle Reports from the web.

    How can we run Oracle Reports from the web - for example from a portal such as "Gateway"
    This is a univeristy that implements Banner - so can we run them from within Banner?

    Yes, of course. And for running the reports-server you need an OAS. Maybe here is a good starting point http://www.oracle.com/technology/documentation/reports.html

  • How to Run a Report from Desktop in Oracle 10g without using Web

    Hi Friends,
    I want to run a report from desktop (report which is developed in oracle report developer 10g), for that i have created shortcut. But when i double click on that shortcut it gives me followig error
    "Report name, database connection, and reports server name (unless using local runtime, i.e. reports server call is local) properties must be specified for successful report run"
    the path which is defined in the shortcut of report is as follow
    D:\DevSuiteHome_1\BIN\rwsxu.exe rcptreg_dt userid/password@ORC
    pls help me to sort out the problem.
    Thanks & Regards.

    Hello,
    You can use rwrun. Since 9.0.2 , it is no more possible to DISPLAY the output on the screen , but you can generate a file (HTML , PDF , RTF , ..) and then open the file generated.
    EX: rwrun report=c:\temp\myrep.rdf destype=file desname=c:\temp\myrep.pdf desformat=pdf userid=scott/tiger@mydb P_1=param1_value ...
    Regards

  • How to run ADDM report from client?

    Hi,
    I want to run ADDM report from the client and get the report in my machine?/
    in other words while connecting to sqlplus from my machine if i invoke @?/rdbms/admin/ >> it selects local oracle home..
    Any suggestion to set as if run the remote sql's from sqlplus?/
    Thanks,
    Raman

    You can run the individual built-in packages from SQL*Plus from a client.
    You can also open a browser session to the OEM Grid Server if you know its fully qualified host name or IP Address on your network.
    Be sure, however, that you are licensed to do so. ADDM requires the diagnostic pack license.

  • How to run multiple reports From One Form with 1 report object?

    Hi ALL!
    i want to run multiple reports (in 10g technology) from 1 Form having only 1 report object.
    i.e
    IF parameter=yes THEN
    Rpt_new should run
    Else
    Rpt_old should run
    END IF;
    How can i do this?
    thanks
    rana

    Rana,
    I found this in the Forms online Help. You could easily found it yourself. Don't be afraid of pressing CTRL-H:
    SET_REPORT_OBJECT_PROPERTY(repid, REPORT_FILENAME, 'yourreportsfilename.rdf')Regards,
    Martin Malmstrom

  • How to run a report from a form?

    i created a report from reports 6i. now i want to design an interface in oracle forms and want to call all information from report according to paramaters which i designed in oracle forms.
    i found some information that i can do that using Procedure Run_Report or Run_report_object but i could not achieved it.
    Can anyone explain me that step by step? Or anybody made an example before so a connection from form to report and send to me as a muster. probably i can find a solution for me too..thanks a lot..

    Abdetu thanks for your quickly reply but i have to say that i could not understand it very clearly because i don't have any experience about Forms and Reports. Therefore i am trying to ask my question again with examples.
    I made a report and now i am trying to connect this report to my forms. My forms has 2 search item. Account_no and Date and i have a Run button.
    If i write date "Oct" and push button "Run" i want to see whole list of Oct from Report. Therefore i made a trigger "When-Button-Pressed" and i wrote this and now my question about the parameters.
    In Forms under menu parameters should i create 2 parameters parameter01 and parameter02. and now my questions:
    1) After i create parameters should i write as a Parameter Initial Value
    2) Should i extra add paramters to reports too?
    declare
    v_Report_Id Varchar2(20) := 'RAPOR_NAME';
    v_Parameter_List Varchar2(15) := 'FormParameter';
    v_Parameter_List_Id Paramlist;
    v_Return_Code Number;
    Begin
    v_Parameter_List_Id := Get_Parameter_List(v_Parameter_List);
    If Not id_null(v_Parameter_List_Id) Then
    Destroy_Parameter_List(v_Parameter_List_Id);
    End If;
    v_Parameter_List_Id := Create_Parameter_List(v_Parameter_List);
    Add_parameter(v_Parameter_List_Id, 'PAR_01', TEXT_PARAMETER,:Parameter01);
    Add_parameter(v_Parameter_List_Id, 'PAR_02', TEXT_PARAMETER,:Parameter02);
    Add_parameter(v_Parameter_List_Id, 'PARAMFORM', TEXT_PARAMETER,'NO');
    Add_parameter(v_Parameter_List_Id, 'DESTYPE', TEXT_PARAMETER,'SCREEN');
    Run_product(REPORTS,'v_Rerpot_Id',SYNCHRONOUS,RUNTIME,FILESYSTEM,v_Parameter_List_Id,null);
    End;

  • How to run Discoverer reports from Compensation Workbench?

    Has anyone been able to successfully add a Discoverer report that can be run run from Compensation Workbench? If so can you share the steps?
    I followed the steps described in the following Oracle note, but no luck.
    Adding Discoverer Reports to the Compensation Workbench Home Page [ID 464014.1]
    Thanks
    Jaya

    Please post the details of the application release, database version and OS.
    848716 wrote:
    Has anyone been able to successfully add a Discoverer report that can be run run from Compensation Workbench? If so can you share the steps?
    I followed the steps described in the following Oracle note, but no luck.
    Adding Discoverer Reports to the Compensation Workbench Home Page [ID 464014.1]What is the error you get after following the steps in this doc?
    Thanks,
    Hussein

  • To run a report from command line, when using jdbc-odbc bridge

    Hi,
    How to run a report from command line, when using jdbc-odbc bridge?
    Usually with tns, we do by "rwrun module=<> userid=<user>/<passwd>@tns".
    with odbc, we do by "rwrun module=<> userid=<user>/<passwd>@odbc:DSN"
    Please specify, what is command line arguments for jdbc-odbc bridge driver?
    Environment : Oracle 9i Report Builder on WinNT
    Database : Sybase
    Regards,
    Ramanan

    Hello Ramanan,
    Report Builder : connect JDBC Query in Report Builder is to through Connection Dialog in JDBC Query Editor. User can use a Sign on parameter (can use, default : P_JDBCPDS or can create new) to connect to JDBC Data Source. Connection once made will be mentioned and will be reused through out Reports Builder.
    JDBC PDS allows user to connect one or more same or different kind of databases.
    While running report through runtime or Server, user can pass the sign on parameter(connection string) value, like any other user parameter.
    Syntax for connection string : <username>/<password>@databaseURL . The syntax of database part of connection string depend on the type of JDBC Driver used to connect to Data Source while designing the JDBC Query. databaseURL refer to the location of the database and its format depend on the JDBCPDS river selected in design time while creating the JDBC Query.
    rwrun eg :
    rwrun report=jdbc_odbc.rdf destype=file desname=output.html desformat=html P_JDBCPDS=scott/tiger@database
    Server eg :
    http://server.com:8888/servlet/RWServlet?server=MyReportServer+report=jdbc_odbc.rdf+destype=cache+desformat=html+P_JDBCPDS=scott/tiger@database
    http :
    Please see ORACLE_HOME/reports/conf/jdbcpds.conf for more information.
    With Regards
    Reports Team

  • How do I find the report server name, and then run paper report from forms?

    How do I find the report server name, and then run paper report from forms?
    I am having a problem running report 9i from forms 9i (see below thread). How do I find out the name of the report server? I checked my C:\ids\reports\conf directory but don't see anything that gives me the name of the reports server. I also don't have a iashome directory.
    Also, I just want to run the paper report (not the web version).
    Thanks.

    Hi,
    please read teh Forms / Reports integration paper in teh Collateral section for Oracle9i Forms at otn.oracle.com/products/forms
    In summary, you have to create an external Reports Service that you can then give a name.
    Frank

  • How can print a report from form 6i,  when I press a button?

    hi Friends,
    How can print a report from form 6i, when I press a button?
    When i press a button from Form 6i, the report should print through printer.
    I have done it by using report parameter DESTYPE Printer but problem is that when I press a button printer dialogue box appear and then I give command Print to printer, I don’t want to show Printer dialogue box.
    I want when I press a button form Forms 6i , printer will print my report directly.
    Please send me the solution of this problem.
    Best regards,
    Shahzad

    Hi
    If You are using Client server application then to passing to Add all Print Parameter in the Host Command.
    Means Print command in unix to Host(lp.............) and Other Parameter to file name of the report to print.
    If You not Use Client Server Application the Also Passing a Host Command in Button-Pressed Event and Run.

  • Run a Report from a Forms Menu

    I have a brain teaser,
    I am trying to run a report from a forms menu item. Here
    is my menu item code:
    RUN_PRODUCT(REPORTS,
    'C:\Documents and Settings\Bradley\My Documents\A_THESIS\Reports\AUCTION_EVENT_REPORT',SYNCHRONOUS,RUNTIME,FILESYSTEM,'',NULL);
    When I call on the menu item it works for a while and then a Reports Background Engine error message says:
    REP-0110: Unable to open file 'C:\Documents and Settings\Bradley\My Documents\A_THESIS\Reports\AUCTION_EVENT_REPORT'.
    REP-1070: Error while opening or saving a document.
    REP-0110: Unable to open file
    Any ideas?
    Any help appreciated,
    Bradley

    Frank,
    I tried it at C:\AUCTION_EVENT_RPT with the same result.
    Do you ever run Reports from a form? If so how do you do it?
    Bradley

  • HspRuntimeException while running the report from Workspace

    Hi
    When a user is trying to run a report from Workspace, it prompts teh following error:
    Failed to sync with user provisioning. Check Planning log for detailscom.hyperion.planning.HspRuntimeException
    The report contains 2 grids, 1 pointing to an ASO application, while second pointing to BSO planning application.
    I checked in shared services, the user has the admin access to planning application which is used in the report.
    I tried the following:
    Checked access to planning application for the user
    Restarted the planning application services
    Where in logs will i be able to find details?
    Can anyone suggest some solution?

    Try option 1 then option2:
    Please undertake changes in a test environment. Retest issue and if resolved migrate to other appropriate environments.
    Option 1:
    Verify NETDELAY and NETRETRYCOUNT are at least 1000 & 1500 respectively.
    To set NETDELAY and NETRETRYCOUNT:
    1. Open Essbase.cfg located in Essbase\Bin directory.
    2. Add the following entries
    NETDELAY 1000
    NETRETRYCOUNT 1500
    Restart Essbase agent (windows service)
    Option 2:
    Please backup the registry before making any manual modification.
    1.) Open the Registry
    2.) Navigate to Local Machine\System\CurrentControlSet\Services\TCPIP\Parameters
    3.) Add new DWORD Value named TcpTimedWaitDelay, right click and select Modify. Select decimal radio button, type in 30. (The default value of this parameter is 2 minutes. This is how long it will take for a TCP/IP port that was used by the network for a connection to be released and made available again. 30 sec is the minimum allowed by Microsoft)
    4.) Add new DWORD Value named MaxUserPort, right click and select Modify. Select decimal radio button, type in 65534. ( The default value is 5000.
    This determines the highest port number TCP can assign when an application requests an available user port from the system.
    5.) Add new DWORD Value named MaxFreeTcbs, right click and select Modify.
    Select decimal radio button, type in 6250. (The default value is 2000. This determines the number of TCP control blocks (TCBs) the system creates to support active connections. Because each connection requires a control block, this value determines how many active connections TCP can support simultaneously. If all control blocks are used and more connection requests arrive, TCP can prematurely release connections in the TIME_WAIT state in order to free a control block for a new connection.)
    The above parameters need to be added to the registry on the Planning and Essbase servers. Reboot the servers after the parameters are added.

  • How to run Oracle Reports 6i

    Can any 1 pls help how to execute the report from plsql or scheduled job and not from a form
    I have a report that works fine, The concern now is that somebody will have to manually run this process. It should be something automated, wherein it will run on it's own
    Some batch job which will trigger automatically as per the pre defined schedule
    Thx in advance
    Imran

    Hi Imran,
    If the job is to be scheduled on unix... do you have an report server rwrun60 on your unix machine? (in other words can you deploy your reports on unix?) If so it will be a lot easier not to use dbms_job but just schedule it with the unix scheduler CRON.
    Then you can create a shell script (.bat is used in windows , on unix it should be , actually you even don't need an extention, .unx or .sh)
    eg for your script
    #!/bin/ksh
    ORACLE_HOME=<path to your oracle home on unix>
    ORACLE_SID=<SID of the instance your report needs to run on>
    PATH=$ORACLE_HOME/bin:$PATH
    WORKINGDIR=<your directory where your reports are
    export ORACLE_HOME PATH ORACLE_SID WORKINGDIR
    cd WORKINGDIR
    # if you want more than one report to run at the same time you can use this loop
    for i in `ls *.rep`
    do
    rwrun60 module=$i userid=..... destype=printer (you can of course use other parameters too)
    done
    *If you want just a single report leave the loop out and put name of report afeter module=
    if you save the file ask your unix admins to make it executable and to schedule it with cron on the unix machine
    That's all
    I have several hundreds reports running this way (on Linux with 10g report server)
    Hope it helps
    Erwin
    In answer to you latest question to run from pl/sql it can but you need to be able to run a "host" command from your database
    one way to do it with java class
    install these two java sources on your instance
    (you can leave the FEP1_ out of course)
    CREATE OR REPLACE AND RESOLVE JAVA SOURCE NAMED "FEP1_CaptureStream" AS
    import java.util.*;
    import java.io.*;
    class FEP1_CaptureStream implements Runnable {
    private final InputStream is;
    private final String type;
    private final OutputStream redirect;
    private boolean redirected = false;
    FEP1_CaptureStream(InputStream is, String type, OutputStream redirect)
    this.is = is;
    this.type = type + ">";
    this.redirect = redirect;
    FEP1_CaptureStream(InputStream is, String type)
    this(is, type, null);
    FEP1_CaptureStream(InputStream is)
    this(is, " ", null);
    public void run()
    try {
    PrintWriter pw = null;
    if (redirect != null) {
    pw = new PrintWriter(redirect);
    redirected = true;
    InputStreamReader isr = new InputStreamReader(is);
    BufferedReader br = new BufferedReader(isr);
    String line=null;
    while ( (line = br.readLine()) != null) {
    System.out.println(type + line);
    if (redirected) {
    pw.println(line);
    if (redirected) {
    pw.flush();
    pw.close();
    br.close();
    isr.close();
    } catch (IOException ioe) {
    ioe.printStackTrace();
    second source
    CREATE OR REPLACE AND RESOLVE JAVA SOURCE NAMED "FEP1_ExecOSCmd" AS
    import java.util.*;
    import java.io.*;
    public class FEP1_ExecOSCmd {
    public static void main (String args[])
    int rc = 0;
    if (args.length < 1) {
    System.out.println("USAGE: java ExecOSCmd \'cmd\' ");
    System.exit(1);
    try {
    String cmd = args[0];
    FileOutputStream fos = null;
    if (args.length == 2 ) {
    fos = new FileOutputStream(args[1]);
    Runtime rt = Runtime.getRuntime();
    Process p = rt.exec(cmd);
    FEP1_CaptureStream err = new FEP1_CaptureStream(p.getErrorStream(), "ERR");
    Thread e = new Thread(err);
    /* NOTE we do not join the error thread. If there was no
    Error it may never return. We would wait forever for it to
    return thus janging this process */
    e.start();
    FEP1_CaptureStream out = new FEP1_CaptureStream(p.getInputStream(),
    "OUT", fos);
    Thread o = new Thread(out);
    o.start();
    try {
    rc = p.waitFor();
    /* Handle exceptions for waitFor() */
    } catch (InterruptedException intexc) {
    System.out.println("Interrupted Exception on waitFor: " +
    intexc.getMessage());
    if (fos !=null) {
    o.join(); // need to wait for the output to finish.
    fos.flush();
    fos.close();
    System.out.println("ExitValue: " + rc);
    } catch (Throwable t) {
    System.out.println("ExitValue: " + rc);
    t.printStackTrace();
    Now create a package or standalone procedure to wrap this code
    PROCEDURE EXECUTECMD
    (CMD VARCHAR2
    IS
    LANGUAGE JAVA NAME 'FEP1_ExecOSCmd.main(java.lang.String[])';
    put security ok and then you can use this procedure in a another
    eg
    EXECUTECMD('/mybin/start_reports.sh');
    this will start the sh script
    or
    eg
    EXECUTECMD('/Oracle/bin/rwrun60 module=.....');
    or create a string with all your params and pass it to the command
    Be aware that this command executes on the server where your instance is running!
    Message was edited by:
    Irvine74

Maybe you are looking for

  • Office 2013 is compatible for BEX?.

    Hi All, My user is going update windows 7 with office 2013 , he is asking office 2013 will be supported to BEX?.  Please help me. Thanks, Madhu.

  • Issue while posting through MIRO

    Hi, I am posting through MIRO. I am using two POs in MIRO from different contracts. When I add them for one PO amount and QTY feild is filled up properly, but for other the value of QYT is filled into amount and qty field. Could any one help in solvi

  • IPod touch 2nd gen won't let me get Apps

    Hi, I have an iPod Touch 2nd gen that is operating 4.2.1, and it no longer has App Store, or iTunes. This means that I cannot download any apps or even access music downloads. I have synced with the newest version of iTunes, and the App section is gr

  • Attaching preloader to InDesign swf

    I exported an interactive swf from InDesign (content.swf). It is 7MB. I would like to add a preloader. I found a site that offered a recipe but the swf plays through the frames without stoping on the first frame. Further research indicated I was usin

  • -R DL DVS in UJ-85J drive in MacBook Pro 17

    I'd like to burn a DVD -R DL in the UJ-85J drive in my MacBook Pro - however it doesn't work - system profiler says +R DL but not -R DL - yet this page http://panasonic.co.jp/pcc/products/en/drive/internal/dmd/uj85j.html says it will do -R DL - is th