Monday, October 01, 2007

BIRT Web Service ODA

In the August edition of Eclipse Magazine (www.eclipsemag.net) Virgil Dodson and I wrote an article on the use of the Web Service ODA that is new with BIRT 2.2. One option that we discussed was the use of a custom connection class, which allows the developer the option of specifying a class that will be called which will be responsible for retrieving the web service data. In BIRT 2.2 this feature was initially disabled. With the release of BIRT 2.2.1 this week this feature in now enabled. In addition the driver has been improved by adding a driver class path property to locate your custom connection class.



A custom driver class must implement one method named connect. This method should accept two parameters, which contain the connection properties and application context. This class should instantiate another class that implements an executeQuery Method and a close method. The executeQuery method should accept the queryText (SOAP Request), parameter values and data set properties as parameters. In the example from the article this connection class simply opened a FileInputStream which contained a SOAP response and returned the data.


To use this feature, you will still need to provide a SOAP endpoint or a WSDL document when configuring the Data Source. Although the WSDL document can reference methods that may never be called in your custom class, essentially making it a dummy WSDL. In the example you will note that the SOAP request is never used.


An example report and source code using this feature can be found here.


Virgil has also made improvements to the example since it was published , adding pagination and hyperlink controls for navigation which he included in his BIRT Exchange post.


By the way, if you're not familar with it, BIRT Exchange is a community site for BIRT developers that enables you to share code samples, report designs, technical articles, as well as tips and tricks. To read more about the site take a look at this blog.

9 comments:

azuri said...
This comment has been removed by the author.
Jay said...

When I attempt to load the example report and execute it, it fails with a class not found on my.web.service.MyWebService.

I tried adding both the classes directory from the project and the built jar file to the CLASSPATH env variable, with no luck.

What do I need to do to get Birt to recognize that class? I am using Birt 2.3.1 report designer.

Jason Weathersby said...

There is a classpath property for the web service data source. Can you try adding it to it. Or put it in the web-inf/lib directory of the viewer.

Jay said...

I was able to get it to work by adding it to the viewer plugins's scriptlib directory:

%BIRT_INSTALL%\plugins\org.eclipse.birt.report.viewer_2.3.1.v20080908\birt\scriptlib

Thanks!

Jay said...

Sorry, by "it" I mean I added the project jar to the directory.

Rupesh said...

I am Rupesh
I create custom parameter page
i get fioolwing error

java.lang.NullPointerException

at org.eclipse.birt.report.session.ViewingSession.getCachedReportDocument(ViewingSession.java:82)
at org.eclipse.birt.report.session.ViewingSessionManager$ViewingSessionWrapper.getCachedReportDocument(ViewingSessionManager.java:103)
at org.eclipse.birt.report.utility.ParameterAccessor.getReportDocument(ParameterAccessor.java:1117)
at org.eclipse.birt.report.context.ViewerAttributeBean.__init(ViewerAttributeBean.java:169)
at org.eclipse.birt.report.context.BaseAttributeBean.init(BaseAttributeBean.java:233)
at org.eclipse.birt.report.context.ViewerAttributeBean.(ViewerAttributeBean.java:118)
at org.eclipse.birt.report.context.BirtContext.__init(BirtContext.java:44)
at org.eclipse.birt.report.context.BaseContext.(BaseContext.java:69)
at org.eclipse.birt.report.context.BirtContext.(BirtContext.java:30)
at org.eclipse.birt.report.servlet.ViewerServlet.__getContext(ViewerServlet.java:150)
at org.eclipse.birt.report.servlet.BirtSoapMessageDispatcherServlet.doPost(BirtSoapMessageDispatcherServlet.java:243)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
at org.apache.axis.transport.http.AxisServletBase.service(AxisServletBase.java:327)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.eclipse.birt.report.servlet.BirtSoapMessageDispatcherServlet.service(BirtSoapMessageDispatcherServlet.java:122)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:859)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
at java.lang.Thread.run(Unknown Source)

Jason Weathersby said...

Can you post the code you used?

Driscoll Hunter said...

This category should instantiate another category that utilizes an executeQuery Technique and a near method.

sravani reddy said...

hello please tell me how to integrate the java with birt report ..when i click on the submit button, birt report is open that is my task..

can anyone help me please....

thank you.