Consuming a Web 2.0 resource has never been easier, since REST (Representational State Transfer) has become a widespread standard. All the web giants offer RESTfull web services: Facebook, Flickr, Youtube, LinkedIn, Xing, MySpace and many more. As more and more applications tend to interconnect with all of these social-media-life-sharing services out there, there is no doubt that you will not be able to develop anything in the near future without knowing how to “consume” or “produce” RESTfull Web Services. Fortunately, APEX 4.0 has a simple and straightforward way of consuming Web Services.
1. Identify the Web Service you wish to use
In our case, www.deviceidentifier.com, a web site that provides a web service based on the user agent, that identifies what kind of device was used to access your website. We will use this site to identify if the user is accessing www.apexninjas.com from a mobile device, in which case we will redirect to a mobile version of ApexNinjas (stay tuned). DeviceIdentifier.com has a simple page describing how to use it’s web service: http://www.deviceidentifier.com/rest/
From the documentation, we must pass 3 parameters (sitekey, format, user-agent) to http://www.deviceidentifier.com/rest/capabilities-base.php as a GET request, and the response will be returned in XML or JSON format in the
response_dataout put parameter.
Probably one of the most overlooked feature of APEX is the use of supporting objects. I have just run into them (the supporting objects, that is…) after realising that my application images were not exported when doing a simple application export. Turns out that static files, css and static files must be defined as supporting objects and have installation scripts created. And then, during the import, you have the option to run the install scripts for the supporting objects.
From the beginning:
1. Create installation scripts from the application images
As we mentioned in previous articles, a cost-free solution to obtain printing in APEX are the XSL-FO report layouts. We explained the solution in several articles:
– Custom APEX PDF Printing. Editing XSL-FO report layouts
– More on PDF Printing and XSL-FO layouts
And we, ApexNinjas.com developed the ALGEN application that you can download and use to generate your own report layouts.
But a while ago we came across an alternative to XSL-FO report layouts. Dietmar Aust suggested using JasperReports to generate report printing in APEX in a post on his blog: ODTUG2009 PDF Printing. This article contains the presentation slides where he explains and details the integration of the open source Java reporting engine “JasperReports” into Oracle Application Express for PDF and RTF printing.
As we specified in the first article on this topic, we are back with the instructions about how to install the needed software in order to integrate the Jasper Reports in your Apex application. We followed the instructions presented by Dietmar Aust on the Jasper Reports integration website. Actually a lot of the things in this material are taken from that website and we added some observations about certain aspects that we came across.
Procedure inspired from http://www.opal-consulting.de/apex/f?p=20090928:4
About the integration
The main purpose is to provide a cost free alternative for high-fidelity printing/PDF generation with Oracle Apex. For doing so, was built an integration kit to easily run ‘Jasper Reports’ reports from within an Oracle APEX application.
How does it work?
For the integration was chosen the Open Source reporting engine Jasper Reports (basically a java library) to run reports against an Oracle database to produce reports in various formats like PDF, RTF and XLS.
This integration approach focuses on the integration with Jasper Reports, but is not limited to it. Using a generic URL-based approach, it can easily be extended to call any other reporting engine that provides a URL based interface for running reports, for example Oracle Reports, BIRT or Crystal Reports.