Integrating Web
Services With Oracle BI Beans
If you've read any of my
previous articles on
Qubeview,
our new Oracle 9i OLAP analysis and reporting
suite, you'll know that it was developed using
Oracle JDeveloper 9i,
Oracle Business Intelligence Beans and Java
J2SE 1.4. Because of the technology we used,
it's been relatively easy to extend Qubeview's
functionality and an interesting new area we've
been developing is integration with
web services.
The term 'web services'
describes a standardized way of integrating
Web-based applications using the XML, SOAP, WSDL
and UDDI open standards over an Internet
protocol. XML is used to tag the data, SOAP is
used to transfer the data, WSDL is used for
describing the services available and UDDI is
used for listing what services are available.
Used primarily as a means for businesses to
communicate with each other and with clients,
Web services allow organizations to communicate
data without intimate knowledge of each other's
IT systems behind the firewall. Web services
allow different applications from different
sources to communicate with each other without
time-consuming custom coding, and because all
communication is in XML, Web services are not
tied to any one operating system or programming
language. For example, Java can talk with Perl,
Windows applications can talk with UNIX
applications.
This exercise used JDeveloper 9i
to access a freely available Currency Conversion
web service from
www.xmethods.net. The generated stub is then
deployed in a
Qubeview Plug-In that provides a data table
with the currently selected dataview translated
into the corresponding currency.
Building the Currency
Conversion Stub
Oracle9i JDeveloper makes
creating and consuming Web services a
point-and-click exercise. First find the
Currency Exchange Service located under the UDDI
Registry node.

Next, establish the relevant
Service Name (in this case
getRate).

The wizard then generates the
appropriate XmethodsCurrencyExchangeStub class.
You can test the generated class by adding a
line to the class's Main method
//main class
public static void main(String[] args)
{
try
{
XMethodsCurrencyExchangeStub stub = new
XMethodsCurrencyExchangeStub();
// Returns the current conversion rate between the US & UK
System.out.println( stub.getRate("usa", "united kingdom") );
}
catch(Exception ex)
{
ex.printStackTrace();
}
}
The getRate method takes two
string arguments and returns a number of type
float. The two arguments represent the to and
from countries ( a complete list of countries is
available from www.xmethods.com. The returned
value represents the current exchange rate.
Using the new Conversion
class In Qubeview
Oracle's BI Bean technology
provides a set of Java Beans that allow you to
build reporting and analysis tools on Oracle's
OLAP technology. The Qubeview suits of products
is available in beta forma at
www.qubeview.com and provides an
implementation of the technology.
One facet of Qubeview is the
ability to build customized plug-ins for
Qubeview Desktop that allow the analysis layer
to be augmented and moulded to the user. By
following the framework of the Qubeview SDK, a
plug-in can be developed that will show the
user's presentation alongside the corresponding
converted values.
The following code shows how to
loop over and return the data values from a BI
Beans crosstab. The values are then converted
and added to a vector which can be used to
display the new values in a JTable.
//create
exchange class
XMethodsCurrencyExchangeStub xmCurrency = new
XMethodsCurrencyExchangeStub();
//get
selected currency
String s2 = xmCurrency.getRate("UK",
currency).toString();
double d2 = Double.parseDouble(s2);;
//get row &
data info
for(int row=0;row <
da.getEdgeExtent(DataDirector.ROW_EDGE);row++)
{
//use a
temporary vector
Vector tmp = new Vector();
//retrieve
header values from the dataview
for(int layer=0;layer<layerCount;layer++)
tmp.add(
getHeaderMembers(da,DataDirector.ROW_EDGE,
row, layer ) );
//data
for(int
col=0;col<da.getEdgeExtent(DataDirector.COLUMN_EDGE);col++)
{
//get data value
String s1 =
da.getValue(row,col,DataMap.DATA_UNFORMATTED).toString();
//convert
string to double
double d1 = Double.parseDouble(s1);
//get
converted value
double val = d1 * d2;
//add value
to vector
tmp.add(Double.toString(val) ) ;
}
data.add(tmp);
}
When deployed, the end-user can
bring up the Currency Conversion table by
clicking the corresponding icon on the Qubeview
toolbar and selecting the desired currency
option from the menu system.

For many businesses and
developers, the power of web services will be
the ability to hurdle cross-platform barriers
and to integrate the inherent, data related
power of individual business applications. In
this particular example, the gain is simply one
of productivity afforded by JDeveloper.
Embedding currency conversion abilities into
systems is not new- being able to do this in a
few lines of code is.
Publicly available web services
include currency conversions such as this, SMS,
messaging and fax modules that allow developers
to aggregate services to provide highly
available and feature rich applications. The
next generation of web services will see modules
of business logic made available for the
exchange of information, workflow and decision
making. For Business and Data Warehousing this
means making all your reports available as
published Web services. This not only allows the
business to view and interrogate reports on any
device from laptop to PDA to mobile phone - it
also provides the ability for you to
interrogate reports on any
device from laptop to PDA to mobile phone
- it also provides the ability for
applications to take decisions without
human intervention.
For example a report,
published as a web service might use the
analytic workspace to forecast the worst
performing regions of a particular product
in a particular region. This not only
forms interesting reading for field based
sales managers but could also form the
basis of a CRM related mail-shot to
customers or retailers without the need
for human intervention. The world's
greatest, most valuable business service
or report is worth nothing if it is not
available to your target audience or is
too hard to use. Web services by their
nature are available over the internet,
solving the issue of availability, and
tools such as Oracle JDeveloper can easily
access these services.
If you're interested in
finding out more about Qubeview and
integration with web services, Julian Ford
is presenting
"Intelligent Performance Management With
Qubeview" at the forthcoming
Eworld Integration : The Next Corporate
Challenge event on the 18th and 19th
of May at the Russell Hotel, London, where
there'll also be presentations by Oracle,
IBM, Hyperion, Microsoft and Datamirror.
Alternatively, take a look at the Qubeview
website where you can
register to download the latest beta
version of the software. We're also
looking for beta site participants who
will receive preferential consideration on
enhancements and favourable licensing
terms, so if your organization is
interested in participating in the
development process, let us know when you
sign up for the beta and we'll be in
contact.