Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » BIRT » Changing Web Service Request Parameter's Value
Changing Web Service Request Parameter's Value [message #1230017] Fri, 10 January 2014 20:10
David Phan is currently offline David PhanFriend
Messages: 1
Registered: January 2014
Junior Member
Environment:

BIRT 4.3 runtime

Objective:

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.

Sample code:

// 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();

...

Problem:

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.

Debugging:

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.
Previous Topic:Confirmation of download location for 4.3.1 source bundle (for osgi birt version)
Next Topic:Inquiry on how to apply Chart Theme dynamically in report
Goto Forum:
  


Current Time: Wed Sep 11 17:05:23 GMT 2024

Powered by FUDForum. Page generated in 0.04989 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top