Bug 425449 - Bad SOAP Request When Changing Default Value of a Parameter
Summary: Bad SOAP Request When Changing Default Value of a Parameter
Status: NEW
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: BIRT (show other bugs)
Version: 4.3.1   Edit
Hardware: PC Linux
: P3 blocker (vote)
Target Milestone: ---   Edit
Assignee: Birt-ReportEngine-inbox@eclipse.org CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-01-10 15:28 EST by David Phan CLA
Modified: 2014-01-10 15:28 EST (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description David Phan CLA 2014-01-10 15:28:44 EST
[b]Environment:[/b]

BIRT 4.3 runtime

[b]Objective:
[/b]
I have defined a .rptdesign file, in which I used a Web Service Data Source.  The .rptdesign file includes the URI of the WSDL and a parameter with a default value.

However, I'd like to generate reports within my Java code by loading the .rptdesign and modify the URI and the parameter's value to appropriate values.

I was able to change the URI without any problems; but changing the parameter's value is cumbersome.

[b]Sample code:[/b]

// Create engine config
...

// Create engine factory
...

// Create render option
...

// Create report engine
IReportEngine reportEngine = engineFactory.createReportEngine(engineConfig);

// Create report runnable
IReportRunnable reportRunnable = reportEngine.openReportDesign("../myreport.rptdesign");

// Get DataSetHandle
DesignElementHandle designElementHandle = reportRunnable.getDesignHandle();
DataSetHandle dataSetHandle = ((ReportDesignHandle) designElementHandle).findDataSet("Track By ID Data Set");

Iterator iter = dataSetHandle.parametersIterator();

while (iter.hasNext()) {
    OdaDataSetParameterHandle parameterHandle = (OdaDataSetParameterHandle) iter.next();

    String paramName = parameterHandle.getName();
    if (paramName.equals("ID")) {

        // Change the default value of this parameter to something else
        parameterHandle.setDefaultValue("1");
    }
}

// Create a task and generate report
IRunAndRenderTask task = reportEngine.createRunAndRenderTask(reportRunnable);

task.run();

...

[b]Problem:[/b]

If I don't change the parameter's value the report is generated fine.

The parameter's default value is "0".  Changing it to "1" somehow messed up the SOAP request, which caused the server to return 500.

[b]Debugging:[/b]

After looking at BIRT runtime code, I figured out the underlying cause of the problem.  But I don't know how to fix it.

1. The OdaDataSetParameterHandle.setDefaultValue() method takes a String object as input.

2. At some point, the ExpressionPropertyType.validateValue(Module, DesignElement, PropertyDefn, Object) method gets called to validate the data.  During validation a new Expression object is created.  Since the new value is of type String, it'll create a new Expression object with this code:

    return new Expression ( expr, null );

3. The second parameter of the Expression constructor is the cause.  If this is passed with the value "constant", everything would work fine.

The problem is I can't figure out a different way to change parameter's value.