Oracle Service Bus : Agility in Action

Yesterday I followed a session regarding OSB given by Jeff Davis, it was an interesting session with a lot of demo’s regarding using business services and proxy services.

Topics that we’re interesting to me during the session and I would like to share with the community:

  • Coherence ships with OSB/Weblogic which gives you the possiblity to cache service results to speed up performance. As Jeff mentioned a case could be that your users need to get the latest financial results each day which is a long running business process. This process can be launched asynchronously when the user is logged on in the background. The result of the process is then put in the service cache so when the user needs the information it’s shown to him without delay. The Service Result Caching functionality is integrated within OSB 11G, Release 1.
  • OSB 11g, Release 1 is also fully integrated with Enterprise Repository which gives you the possiblity to index all your existing services using your metadata such as XML, XSD, WSDL, … Using Enterprise Repository the impact of changes made to individual services is clear which makes your release management process a lot easier! Make sure to check out the features and functionality delivered by the Enterprise Repository to be able to govern your services throughout the enterprise.
  • OSB12C (C stands for Cloud) is the next upcoming release of OSB which holds a lot of new interesting functionality such as templating/prototyping services, development is integrated within Jdeveloper, … The fact that the development will be integrated within Jdeveloper gives your development team the possibility to use one and only one IDE to have E2E development from database to business components, to services such as bpel, osb, external services, business rules untill the end-user interface

During the demo Jeff showed how you can expose functionality of an EJB 3.0/2.1 module as a service using business services and proxy services. You can transform from an EJB 3.0 business service to an EJB 2.1 Proxy Service using XQuery and the JEJB protocol.

Oracle Forms Modernization seminar

iAdvise organises a seminar on Forms modernization.

During this seminar we will show you how you can modernize your Oracle Forms applications, give it a rich look and feel, and adopt the latest technologies without throwing away years of investment in Oracle Forms.
We will show you how you can combine the power of an Oracle Forms application with functionality from external application (javabeans, pluggable java components, webservices,…) and how you can give a Forms application a modern “look and feel”.

Also part of this seminar is an overview of the new features in the latest Oracle Forms release(11g)

When: June 1, 2010
Where: iAdvise office, Kontich
Language: Dutch

View invitation

Calling Webservices from pl/sql

For a client of us we had to call a webservice from a database, and the received information that we received from this call was needed in another procedure.

It was the first time for me that I had to do this and I believe that not so many people now of this functionality in the database and that’s why it is obviously a good idea to post this on our blog.

It is even possible to let the database be a webservice provider, but in this case the webservice already existed and should simply be called by the database.

What was the objective: we wanted to call the webservice from the database, get the resulting XML file and analyze some of the content of the returned XML file and then do some actions with the information that the webservice provided us.

Therefore I wrote 3 procedures in a package:
• fnc$_get_xml
• fnc$_handle_xml
• prc$_ws_call

As you will see when you look at the code it is possible to make this much more dynamically but for this case we only had to call only one specific webservice, as usual you can make it very complex but for the blog I made the procedures and functions as simple as possible.

The first function that I will explain is the prc$_ws_call
This procedure will contact the function fnc$_get_xml that will get the xml file. After this function the fnc$_handle_xml will be called to retrieve specific information out of the XML file.
When this is done the received values will be printed

PROCEDURE prc$_ws_call
v_xml VARCHAR2(32767);
v_type cab_base_adres.type%TYPE;
r_receive r_info;
v_xml := fnc$_get_xml(p_search => ‘search value’); –call to webservice
r_receive := fnc$_handle_xml(v_xml); –analization of xml content
dbms_output.put_line(‘value nr1=’||r_receive.value1) ;
dbms_output.put_line(‘value nr2=’||r_receive.value2) ;
dbms_output.put_line(sqlcode||sqlerrm) ;

This function will receive a parameter(search) this parameter will be included in the soap call(called v_soap_request).
Ones that I have build my soap envelope, I have to create a httpRequest, this is the variable v_httpRequest which is of the type utl_http.req.
For this variable I have to set some parameters like the webservice url that I will call, the content-type (plain text in this case), the content_length of the soap envelope and the specification that this is a soapaction. This is the preparation for the call to the webservice.

Next thing to do is to write this data to the body of the http request, this is done with the utl_http.write_text where we give in the http_request and the soap_request.
Now we want to receive the response from our soap call.
This will be created with the utl_http.get_response which is of the utl_http.resp type.

Next thing we want, is to have this file in a readable form. Therefore we use the utl_http.read_text, that will translate the response in a readable variable.

FUNCTION fnc$_get_xml(p_search VARCHAR2)
v_soapRequest VARCHAR2(32000);
v_soapResponse VARCHAR2(32767);
v_httpRequest utl_http.req;
v_httpResponse utl_http.resp;
v_soapRequest :=
‘<?xml version=”1.0″ encoding=”UTF-8″ standalone=”no”?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV=”; xmlns:apachesoap=”; xmlns:impl=”<the webservice>” xmlns:intf=”<the webservice>” xmlns:soapenc=”; xmlns:tns1=”” xmlns:wsdl=”; xmlns:wsdlsoap=”; xmlns:xsd=”; xmlns:xsi=”; >
<mns: <webservice name>xmlns:mns=”<services link>” SOAP-ENV:encodingStyle=””&gt;
<inputAddress xsi:type=”tns1: <input parameter name>”>
<input search xsi:type=”xsd:string”>’||p_search||'</search>
</mns: <webservice name> >

v_httpRequest:= utl_http.begin_request

utl_http.set_header(v_httpRequest, ‘Content-Type’, ‘text/xml’);
utl_http.set_header(v_httpRequest, ‘Content-Length’, length(v_soapRequest));
utl_http.set_header(v_httpRequest, ‘SOAPAction’, ”);

utl_http.write_text(v_httpRequest, v_soapRequest);
v_httpResponse:= utl_http.get_response(v_httpRequest);
utl_http.read_text(v_httpResponse, v_soapResponse);
RETURN v_soapResponse;
dbms_output.put_line(sqlcode||sqlerrm) ;
dbms_output.put_line(‘Error in fnc$_get_xml’) ;

Great, we have now received the xml file that contains the result of our request. Now we want to retrieve the data we need, out of this XML file.
Therefore I will call the fnc$_handle_xml function with the received XM file as parameter.

I will have to handle the content of the xml file. To make this easier I am going to put the content of the XML file into an XMLType by using the XMLType.createXML function. Now the parameter resp contains the XML file. But I am only interested in a certain part of the XML file. By using the ‘extract’ function I am able to get a certain part out of the hierarchical structure of the XML file.

Next thing that I want to receive is the information of certain parts of this resp variable. I will put his in the resp1 variable which make it possible to always use the resp file for the next value I want to retrieve.

In this example I get 2 values out of the XML file. And I will return this back to the calling procedure.

FUNCTION fnc$_handle_xml(p_xml VARCHAR2)
RETURN r_info
resp XMLType;
resp1 XMLType;
r_result r_info;
resp:= XMLType.createXML(p_xml);
resp:= resp.extract(‘/soap:Envelope/soap:Body/child::node()’
, ‘xmlns:soap=””&#8216;

resp1:= resp.extract(‘/multiRef[2]/<xml level>/text()’
, ‘xmlns:ns2=”<beans url>”‘
r_result.value1 := resp1.getStringVal();

resp1:= resp.extract(‘/multiRef[2]/<xml level>/text()’
, ‘xmlns:ns2=”<beans url>”‘
r_result.value2 := resp1.getStringVal();

RETURN r_result;
dbms_output.put_line(sqlcode||sqlerrm) ;
RETURN r_result;

Buzzing About Adobe Flex – Part 2

Some useful background information you need to know about Adobe Flex … (which you can find in the Adobe Flex Developer Guide):

About Flash Player 9
While Flex applications run in a browser, they take advantage of the Flash Player 9 runtime environment for executing client-side logic, rendering graphics, and playing animation, audio, or video.
Flash Player 9 supports a new higher-performance version of ActionScript
(ActionScript 3.0) that works in conjunction with the expressiveness innovations
in Flash Player 8.

At the core of the Flex product line is the Flex Software Development Kit (SDK). Flex 2 SDK consists of the Flex framework (class library), the Flex compilers, the debugger, the MXML and ActionScript programming languages, and other utilities. Flex SDK also includes the source code for the core Flex framework class library, enabling you to study the code of the classes as well as customize or extend them for your own use.

About Flex Builder 2
Flex Builder is an integrated development environment (IDE) for developing applications with Flex SDK, Flex Data Services, and the Flash Player. The Flex Builder IDE provides tools that help you develop, design, and debug Flex applications, including an integrated incremental compiler and a step-through debugger.

About Flex Data Services 2
You build on the functionality of Flex 2 SDK by adding Flex Data Services. Flex Data Services adds enterprise messaging support and a greatly enhanced data services architecture to the Flex 2 SDK. You deploy Flex Data Services as a standard web application on your J2EE application server or servlet container.

– Adobe Flex Developer Guide – is the document to have a look at.

Today I want to have a closer look at the data-binding layer of Adobe and how I can create CRUD-screens.

Working with data services
Flex is designed to interact with several types of services that provide access to local and remote server-side logic. For example, a Flex application can use AMF to connect to a web service that uses the Simple Object Access Protocol (SOAP), an HTTP URL that returns XML, or for Flex Data Services, a Java object that resides on the same application server as Flex. The MXML components that provide data access are called data service components. MXML includes the following types of data service components:
WebService Provides access to SOAP-based web services.
HTTPService Provides access to HTTP URLs that return data.
RemoteObject Provides access to Java objects (Java Beans, EJBs, POJOs) by using the AMF protocol. This option is only available with Flex Data Services or Macromedia ColdFusion MX 7.0.2.

I need to use the Flex Data Services to be able to add data-bound components into my Adobe Flex Application.

How to build a Data-Driven application (using the Adobe Flex Developer Guide, Chapter 9):

Using the HTTPService – data service component I’m able to integrate an existing rss-feed from a blog to populate a DataGrid-component in my Flex Application. Looks very fancy and it’s not hard to try this out.

Using the WebService – data service component I can call a webservice and get back the results in a datagrid-component. You can learn how to pass parameters into the webservice and how to react when the webservice is calles, e.g. when the user invokes a certain action or when the application has been displayed (e.g. onPageLoad or to say in Flex-language on
creationComplete). You will actually work in the same way as when using the HTTPService only you’re invoking a webservice endpoint instead of a HTTP request.

Data Management Services, chapter 19, discusses the different adapters that are need to use persistent or transient data in an Adobe Flex Application.
The ActionScript object Data Management Service adapter persists data in server memory and is useful for applications that require transient distributed data that is not persisted.
The Data Management Service Java adapter will be used for data that is persisted to a data store.

I need to download a trial version of LiveCycle Data Services ES , to be able to integrate Data into my Adobe Flex application.

I’ve already tried to create a Database Accessor to my Oracle schema but this doesn’t seem to work regarding a bug reported by Adobe. When you try to create a connection to an oracle db with more than 1 schema, which would be the case for 99% of th time, the data connector can’t establish the connection.

So when you want to create a CRUD-application using Oracle as your db, you need to wait for a patch/new beta release.

What are the pro’s and con’s I’ve seen today:

  • Pro: integrating a HTTPService, a blog for example, is very straightforward and doesn’t ask any specific modifications or knowledge from the developer (except reading the dev guide ;o) )
  • Con: renaming the mxml file still holds the old swf- and html-files in the bin-folder, these can be removed manually without any impact on the application
  • Con: Not able to delete a Database Accessor you’ve defined earlier, not clear how to edit the existing Database Accessor either
  • Con: Exceptions thrown when having a look at existing , e.g. try to access twice in a new browser session => the following error is shown:

ArgumentError: Error #2082: Connect failed because the object is already
connected. at at
com.noventaynueve.underwater::Launch() at main() at
[execute-queued] at [io]

That’s it for today … I hope I can build a small application using an Oracle database.