Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » BIRT » XML Data-Source request method(How do I set the request method on an XML Data-Source to be called using the POST method (default appears to be GET))
XML Data-Source request method [message #729999] Tue, 27 September 2011 08:50 Go to next message
TerryWyatt01 is currently offline TerryWyatt01
Messages: 6
Registered: April 2011
Junior Member
Using BIRT 2.6.0 report engine.

I am executing a report that uses an XML data source generated by an HTTP server with a parameter that is a delimited list of items to report on. This list can be quite large (too large for a GET request). I need to be able to change the data source to exeucte using a POST HTTP request method, but am unable to find any examples or documentation on how to set this option.

Can anyone help?

Thank you in advance.

Terry
Re: XML Data-Source request method [message #730109 is a reply to message #729999] Tue, 27 September 2011 12:12 Go to previous message
Jason Weathersby is currently offline Jason Weathersby
Messages: 9167
Registered: July 2009
Senior Member

Terry,

Do these parameters just reduce the number of rows or does the schema
change. Because you could always use a beforeOpen script on the data
set to open a URL connection and load up a byte array input stream and
set the appcontext variable:
"org.eclipse.datatools.enablement.oda.xml.inputStream" This will cause
the xml data source to use this data. For example I hard code the
results in the example below.


importPackage( Packages.java.io );

var mystr = "<?xml version=\"1.0\"?>";
mystr = mystr + "<library>";
mystr = mystr + "<book category=\"COOKING\">";
mystr = mystr + "<title lang=\"en\">The test3 Cook Book</title>";
mystr = mystr + "<author name=\"Miguel Ortiz\" country=\"es\"/>";
mystr = mystr + "<sold>10,312</sold>";
mystr = mystr + "<year>2005</year>";
mystr = mystr + "</book>";
mystr = mystr + "<book category=\"CHILDREN\">";
mystr = mystr + "<title lang=\"en\">Everyone is Super Special</title>";
mystr = mystr + "<author name=\"Sally Bush\" country=\"uk\"/>";
mystr = mystr + "<sold>8,222</sold>";
mystr = mystr + "<year>2005</year>";
mystr = mystr + "</book>";
mystr = mystr + "<book category=\"AUTOBIOGRAPHY\">";
mystr = mystr + "<title lang=\"en\">Japanese Greetings</title>";
mystr = mystr + "<author name=\"Taro Yamada\" country=\"uk\"/>";
mystr = mystr + "<sold>7,852</sold>";
mystr = mystr + "<year>2005</year>";
mystr = mystr + "</book>";

mystr = mystr + "<book category=\"WEB\">";
mystr = mystr + "<title lang=\"en\">Query Kick End</title>";
mystr = mystr + "<author name=\"James McGovern\" country=\"us\"/>";
mystr = mystr + "<sold>15,111</sold>";
mystr = mystr + "<year>2006</year>";
mystr = mystr + "</book>";
mystr = mystr + "<audio format=\"CD\" category=\"MUSIC\">";
mystr = mystr + "<title lang=\"en\">Feels Like Home</title>";
mystr = mystr + "<artist name=\"Norah Jones\" country=\"us\"/>";
mystr = mystr + "<sold>9,675</sold>";
mystr = mystr + "<year>2005</year>";
mystr = mystr + "</audio>";
mystr = mystr +"</library>";

JavaStr = new java.lang.String( mystr );
bais = new ByteArrayInputStream( JavaStr.getBytes());
appcon = reportContext.getAppContext();
appcon.put("org.eclipse.datatools.enablement.oda.xml.inputStream", bais);


You could always open the url like:
importPackage(Packages.java.net);
importPackage(Packages.java.io);

dataURL = new URL("http://..");
dataConnection = dataURL.openConnection();
inp = new BufferedReader( new
InputStreamReader(dataConnection.getInputStream()));

//while loop load up bais
inputLine = inp.readLine();


Jason

On 9/27/2011 8:50 AM, TerryWyatt01 wrote:
> Using BIRT 2.6.0 report engine.
>
> I am executing a report that uses an XML data source generated by an
> HTTP server with a parameter that is a delimited list of items to report
> on. This list can be quite large (too large for a GET request). I need
> to be able to change the data source to exeucte using a POST HTTP
> request method, but am unable to find any examples or documentation on
> how to set this option.
>
> Can anyone help?
>
> Thank you in advance.
>
> Terry


Jason Weathersby

BIRT Exchange
Previous Topic:Chart scripting with report variables
Next Topic:Global Script functions in a library
Goto Forum:
  


Current Time: Sat Apr 19 06:07:21 EDT 2014

Powered by FUDForum. Page generated in 0.01443 seconds