Thursday, December 22, 2005
SearchWebServices: Oracle's Steve Harris on Java and standing out in SOA, part 1
Tuesday, November 22, 2005
Oracle 10g: Oracle Open World Top 10 presentations
1. Optimizing the Optimizer: Essential SQL Tuning Tips and TechniquesEnjoy!
2. 10 Things We Like About Oracle Database 10g Release 2
3. PeopleSoft Enterprise, JD Edwards, and Oracle E-Business Suite Integration with Oracle Fusion Middleware
4. The Future of Database and Information Technology
5. Understanding Shared Pool Memory Structures: Tips on How to Optimize Usage and Avoid Errors
6. Take the Guesswork Out of Database I/O Tuning
7. Tuning Oracle SQL in the Real World
8. What They Didn't Print in the Doc: High-Availability Best Practices from Oracle Maximum Availability
9. Performance Diagnostics Demystified: Best Practices for Oracle Database 10g
10. Best Practices for Oracle Database 10g Backup and Recovery
Friday, November 11, 2005
Using Eclipse WTP and OracleAS/OC4J
The challenge here is not how you build J2EE components using an IDE, but more how do you package, deploy and run your application easily from the IDE. Eclipse WTP allows you like Oracle JDeveloper does, to package the various J2EE components in standard archives (JAR, WAR, EAR, RAR, ...) and deploy them to a J2EE container. WTP project has a very nice list of containers you can deploy to: Oracle, IBM, BEA, JBoss, Tomcat, ...
With the latest build of Eclipse WTP (Release 1.0M8), Oracle Application Server 10g is now part of the default server list. So if your are an OracleAS user you can now use WTP and start to run and debut your application running in OracleAS from Eclipse.
What do you need to start using WTP and OracleAS:
- Download and install Eclipse WTP 1.0M8 from Eclipse site.
- Download and install OracleAS 10g (OC4J 10.1.3 Developer Preview 4) from OTN
- You must set a administrator password for OC4J using the start command
- Done! You can now use OC4J
and Eclipse. I have a viewlet that shows the basic steps to create and
run your first Web application.
Thursday, October 27, 2005
Installing Blojsom on OracleAS 10g (10.1.3)
I am using internally Blojsom for blogging about the product I am
taking care of: OC4J and especially the Web Services stack. In this
post I am quickly documenting, as the title says, how to install
Blojsom on OracleAS 10g.
1-Download
The first thing to do is to download the product itself, just download the Blojsom quickstart from sourceforge.
2-Deploy
Since, Blojsom is distributed as a WAR file you have nothing special to
do, just deploy it. Anyway I have created a viewlet that shows
step by step deployment using Oracle Enterprise Manager.
So the application link will be: http://localhost:8888/blojsom/
Note: if you want to use the command line utility (admin.jar) or the Ant deployment task, you should package the Web archive in an EAR file.
3-Update the home page
The easiest way will be to just change the index.html page to redirect
to the default blog. The index.html page to be modified is in:
- $ORACLE_HOME/j2ee/home/application/blojsom/blojsomXXXX/index.html
4- Start blogging...
This is it...
Monday, October 24, 2005
PHP will beat Java? Not sure about it...
I would like react to last week marc andreessen's words (netscape founder during the php/zend conference andreessen basically says that PHP will beat Java and succeeds where Java is not. Most of the reasons that Andreesen used to justify this saying are because of PHP simplicity. Do you think he is talking about the language or the application server -yeah, let's call it this way... (J2EE...)..
Let's talk about J2EE first, it is true that when you take a look to the learning curve of J2EE and PHP it is a no brainer.. PHP is effectively more simple. But we can start with the acronyms themselves: J2EE==Enterprise, where PHP==Personal Home Page ( since then renamed Hypertext Processor). So from the origins the 2 technologies were not here to achieve the same goals. But PHP has proven that it could be used for complex application/Web sites, and still keep it simplicity.
So PHP is simple this is true, but Java on the server could be also. I think that the complexity comes from the fact that J2EE its expert always see an application as a enterprise application, and what that means in term of life cycle, development process, packaging and so on.... Why am I saying that it is coming from the expert? Just take a look to a PHP tutorial and a J2EE one? This is clear that you must be a very good and experienced developer to start with J2EE... But this is is not coming from the technologies, but mainly the way we talk about it. I think we should talk a little more about simple development with Java. For example focusing o JSP and JSTL for simple stuff. I agree that putting too much logic in JSP and reduce the number of layer is 'bad' for complex applications, but it could be used for some. Why do we need to always package a WAR or EAR file? Yes you can technically deploy exploded archive and modify the information after the fact. This is not necessary the best practices but it could be useful for some applications (not necessary only in development environment.
About the language itself, sure that Java is more complex, it is considerate as
a System Level Language, where PHP is a scripting language. Do we still compare
Shell and C? No we need both of them isn't?
In the same time, Java as a language must be simplified, or let be more precise... I think Java developers need the simplicity of scripting languages such as PHP but with the power of Java under the cover. And this is happening right now. JavaScript is now integrated to Java 6, Groovy provided a well integrated JVM with a very powerful and simple syntax. Grails -Groovy On Rails- provided a simple framework for CRUD applications.
Still skeptical about the simplicity of PHP, try it...
Still skeptical about Java being simple, try a scripting language... for
example Groovy
In conclusion the platform of my dream should:
Keep the simple case simple
Made the impossible possible
And I am sure that Java is the good language and platform for that; but Groovy and other scripting languages will help. And I will also continue to develop using PHP too. And both worlds will coexists and be integrated using Web Services and or JSR-223.
Thursday, October 20, 2005
Can I do SOA with Web Services today?
I am just coming back for Toronto where I have been presenting Oracle
Developer Day: SOA for J2EE Developers. As part of this exercise I have
introduced Web Services and related technologies/standards.
A person in the audience asked me:
But can I do SOA Today?I think that is a very interesting and valid question. The answer is certainly:
Are Web Services are mature enough?
Yes you can, and I would add, yes you should!!
Web Services are definitively big actors in Service Oriented Architecture since by definition they are loosely coupled, implementation agnostic and facilitate reusability. In the same time the concern of this person are justified since some important pieces of infrastructure are yet available in vendors solutions. Or if they exist they are proprietary and won't allow interoperability of the service with other stack... Losing interoperability is a big deal when you talk about Web Services since most of the time, if the designers want to use Web Services it is to be able to reuse it in various applications, independently of the platform where this application is running.
Why I have answered Yes?
Why I am so positive when I answered this person? Just simply because
Web Services are today mature enough. But like any development of
applications/systems the development should start with a clear
definition of the requirements. When the development team will start to
write down the requirement it will be clear of not what are the
important pieces in term of services. Beside the business requirements,
lots of requirements are technical/IT related such as security,
performance, manageability, reliability, and transaction management,
performance... So when you design your system do not forgot to clarify
what are the different infrastructure services you need....
It is then easy to match your infrastructure requirement list to the different quality of services supported by the platform you will implementing on, and as important, the platform(s) you will have to integrate with. For example today it is possible to easily create SOA/Web Services application that are secured because WS-Security is a standard supported by most of the vendors. At the opposite it may be very challenging to create SOA/WS based application that involve a very complex transaction model with various applications and system since no standard have been implemented in a real interoperable manner. But no worry the WS brains are here and work on it, take some time to read more about WS-Transactions and other related standardization effort.
Based on the previous example with security and transaction, it is also important to keep in mind that the Web Services is a mature technology but it is still evolving -based on real life requirements-. So in the same time your application/system will evolve -it is one of your goal when you do SOA, it is to build a more agile system that can react to business, or technological changes quicker-, do not forget that your vendor are continuously working to not only define the standard but also implement them in their product. So you may put as a requirement from the beginning a specific infrastructure services that are not available in today's product but the important question to ask you before dropping SOA/Web Service is when I really need this feature? When this feature will be available in my platform?
This is why also it is important to understand the strategy of your vendor in term of flexibility and adaptability of their solution to the different standards, and how it can help you to take care of legacy services that need to integrate with your new applications. One nice example is the usage of Oracle Web Services Manager. Even if WS-Security is one of the first standard around "Enterprise Web Services" it has not been in the different stack for long so lot of existing WS do not support WS-Sec. Oracle Web Services Manager allow you using agents and/or gateway to add security in a standard way to existing services, and enrich you SOA with a better quality of services. So do not say no to SOA/SOA because a standard does not exist or exist but not implemented, it will come -take a look to all the WS-* effort-, and this standards will be able to extend the system that you are building as you need.... SOA is all about agility, to be sure that it will be agile enough to provide you more services as you go!
Tuesday, September 27, 2005
Publishing SQL and DML as Web Service
Oracle Web Service Assembler
If you are not familiar with the Oracle Web Services tools, or if you are using Oracle JDeveloper to generate your services and client, I would like to use the Oracle WS command line utility to do the work here. The Oracle Web Services Assembler, aka WSA, allows you to generate client and server using Oracle JAX-RPC implementation and extensions.WSA is a Java utility that can be used as command line or with Apache Ant, basically it is a Jar file located in $ORACLE_HOME/webservices/lib/wsa.jar. Type the following command in a terminal to learn more about WSA.
java -jar $ORACLE_HOME/webservices/lib/wsa.jar -helpAs you can see with the different command options, Oracle WAS allows you to do "everything" Web Services related, for example creating a WS from an EJB using ejbAssemble, from a stored procedure using plsqlAssemble... and I let you guess, we will be using sqlAssemble for this specific demo.
Usage:
java -jar wsa.jar -<command> -debug -help
where command can be one of:
analyze
annotationAssemble
aqAssemble
assemble
corbaAssemble
dbJavaAssemble
ejbAssemble
fetchWsdl
genApplicationDescriptor
genConcreteWsdl
genDDs
genGatewayService
genInterface
genProxy
genQosWsdl
genValueType
genWsdl
help
jmsAssemble
plsqlAssemble
sqlAssemble
topDownAssemble
version
To have the detail of all the parameters of each command you can just enter
java -jar $ORACLE_HOME/webservices/lib/wsa.jar -[command] -help
Generating the Web Service from a SQL
So you can easily generate a Web Service using WSA from multiple SQL statements, to do it, just use the following command:java -jar wsa.jar -sqlAssembleSo WSA has created the different classes needed by the Web Service but also packaged in a EAR file that you can now deploy to your OracleAS instance. The appName parameter is used to generate the different application name and files (EAR and WAR). The sqlStatement used to specify the different queries you want to publish as operation.
-appName my-soaql-application
-dataSource jdbc/MyDBServices
-sqlStatement "getAllEmp=select ename, sal from emp"
-sqlStatement "getEmpByDept=select ename, sal from emp where DEPTNO = :{dept NUMBER}"
-dbConnection jdbc:oracle:thin:@localhost:1521:orcl
-dbUser scott/tiger
Deploying the application
You can either use Oracle EM Application Server Control to deploy the application or using the command line utility, admin.jar> java -jar $ORACLE_HOME/j2ee/home/admin.jar ormi://hostName[:ormiPort] oc4jadmin password -deploy -file my-soaql-application -deploymentName my-soaql-applicationAlso be sure that you have a datasource defined in your application server that match the parameters set when you ran the WSA command, in my case it will be jdbc/MyDBServices that connection to my local database using the SCOTT schema.
> java -jar $ORACLE_HOME/j2ee/home/admin.jar ormi://hostName[:ormiPort] oc4jadmin password -bindWebApp my-soaql-application my-soaql-application-web default-web-site /soaql
You should now be able to access the service using the following URL:
- http://youserver:port/soaql/my-soaql-application
What is going on?
When you are running the Web Service that is deployed inside OracleAS the flow is quite simple:- A client is sending a request to the server using SOAP. So it uses the different typed as defined in the payload
- The JAX-RPC Servlet processes the request and deserializes the message
- The generated classes use the OC4J DataSource to connect to the database and execute the statement using JDBC
- The database sends the data to the classes, and servlet that creates a SOAP response
When you access the test page ( http://youserver:port/soaql/my-soaql-application ) or when you are viewing the generated WSDL you probably notice that each query is published with 3 different operations. These operations return the same data but using different formats:
- <operationName>Bean : returns the data as serialize Javabean
- <operationName>XML : returns the data in the SOAP body as Rowset/Row structure
- <operationName>XMLRowSet : returns the data in the SOAP body using the WebRowset format (JSR-114)
Summary
In this small article you have learnt how to pulish a SQL statement as Web Service. It is interesting to take a look closely to the WSA tools that give you several way of building Web Services, starting from SQL, Stored Procedure, Java, EJB, or using a contract based approach starting from the WSDL.Tuesday, September 20, 2005
Oracle JDeveloper 10g (10.1.3) EA 1 available
You can now downlaod the Early Access 1 version of Oracle JDeveloper 10g (10.1.3) from OTN.
Oracle Developer Day: September/October Sessions
Oracle Developer Day is a free, hands-on workshop that will give you insight into the latest technologies in SOA and Java. You can choose from one of two topics:
- Track 1: Emerging SOA and J2EE technologies: EJB 3.0, JavaServer Faces and BPEL
- Track 2: Rapid J2EE Application Development for Forms and Designer Developers
- New York, NY – Thursday, September 29, 2005 – New York Metro Area Oracle User Group Day
- Pasadena, CA – Tuesday, October 11, 2005
- Toronto, Ontario – Tuesday October 18, 2005
- Montreal, Quebec – Thursday, October 20, 2005
- Columbus, OH – Monday, October 24, 2005
- Minneapolis, MN – Thursday, October 27, 2005
- Calgary, Alberta – Tuesday, November 1, 2005
Monday, September 19, 2005
Oracle Open World: Monday
Some of the interesting point is the annoucement of the new OracleAS 10g R3, that enhanced the Fusion Middleware to deliver SOA, beside the support of J2EE 1.5, Java 5, EJB 30, JSF, I was very pleased to spend my day demonstrating our new UDDI V3 registry that continue to expend our Web Services stack by giving new services in addition to BPEL and Web Services Manager.
Sunday, September 18, 2005
Oracle Open World: Sunday
The first Oracle World Day for me has started with finishing the various demonstrations of the J2EE Core OC4J and Web Services demonstration Pods. Tomorrow Monday, we will be showing some very cool stuff around Web Services development and management, with some good news around Web Services Registry. Also on the J2EE Core, nice demonstrations of the different services but some of the new features of the OracleAS 10.1.3 such as the new clustering framework and the usage of scripting technologies, especially Groovy, to administer and monitor OracleAS, thanks to JMX!
What about the rest of the day, I was invited to the Web Services Special Interest Group, WS-SIG, - no.. this is not a new acronym in the WS-* world-. This new SIG has been created in the beginning of the year and on the behalf of IOUG, please take a look to the WSSIG web site.
. One of the very interesting things of this SIG is, like the J2EE SIG (Organized by OTUG, IOUG, OAUG and Oracle), developers, architects, and administrators of Fusion Middleware, the Database and Oracle Fusion applications are talking together. This reunion of people is good since we all from development to operations have a different view of systems. So during this panel we have introduced quickly the concepts, and then the audience jumped in for the Q&A session, as you can guess, we add the classical questions around Web Services for the enterprise such as what about security? Management? Life Cycle ?... and so on. We answered obviously, but I would say if you are lucky enough to be at San Francisco this week, please come to the Demo Ground especially Web Services, Web Services Manager and BPEL where you will see the Oracle products in action and you will be able to find experts to help you to answer your questions.
The main auditorium was packed to see the first keynote/show of Oracle Open World 2005, where Oracle presented some of the numerous charity efforts that it does, and offer some fun to the attendees with a nice show from Dana Carvey
What about Oracle Blog dinner?
Mark Rittman is organizing a dinner for the different Oracle bloggers, it will be at the Paragon Restaurant at Second Street on Townsend at 8.00pm on Tuesday 20th. ( I will be there for sure...)Friday, September 16, 2005
Administer and Monitor OC4J using JConsole
- Set the environment:
$ORACLE_HOME to the OC4J home
$JAVA_HOME your JDK home
- Start the OC4J with the
following property set
$JAVA_HOME/bin/java -Dcom.sun.management.jmxremote -jar oc4j.jar
The -Dcom.sun.management.jmxremote system property creates an RMI connector to the MBeanServer, we will use this RMI connector from the console iself.
- Start the JConsole, with the
following command, adding the OC4J administration class to the
classpath.
$JAVA_HOME/bin/jconsole -J-Djava.class.path=$JAVA_HOME/lib/jconsole.jar:$JAVA_HOME/lib/tools.jar;$ORACLE_HOME/lib/adminclient.jar
- The console will
automatically ask you to connect to the OC4J process and you can start
to monitor and administer your OC4J instance
Connection to the OC4J MBean Server
Friday, September 2, 2005
Beta Version of Zend Core for Oracle available
Zend Core for Oracle, developed in partnership with Zend Technologies, supports businesses using PHP with Oracle Database for mission-critical Web applications. It provides a seamless out-of-the-box experience delivering a stable, high performance, easy-to-install and supported PHP development and production environment fully integrated with the Oracle Database.
Zend Core for Oracle will be available as a free download from Zend in late 2005; it is currently available in Beta. Support and updates for Zend Core for Oracle will be made available directly from Zend.
Find more and download link from OTN.
Monday, August 29, 2005
Online Groovy Beginners Tutorial
Thursday, August 25, 2005
YAIM (Yet Another Instant Messenging): Google Talk
Tuesday, August 23, 2005
Oracle at FTP Java Pro Live
- Ted Farell's Keynote
- EJB 3.0: The Next Generation by Mike Keith
- Exploring the Latest J2EE Technologies with Oracle JDeveloper 10.1.3
Saturday, July 2, 2005
JavaOne Hangover
I was not able to attend as much sessions as I wanted, but I had the pleasure to work a lot on the Oracle Booth in the JavaOne Pavillion. I worked on the J2EE, JSF, BPEL and Web Services ones. It was really great, with lot of technical questions around our products; I have to say that this year we had lot of interest around JavaServer Faces and EJB.
And this has been even better after Thomas Kurian's keynote on Tuesday with the following annoucements:
- Oracle is participating to MyFaces project. You can find more information on JavaServer Faces on OTN.
- Oracle will lead the development of the JSF extension for Eclipse, as you may know Oracle JDeveloper, now free, has one of the most appealing JSF Designer tool. So we are currently porting this design tools inside Eclipse, to facilitate the adoption of Faces by the developers.
- Mike Keith, Toplink Architect, will be now co-specification leader of the persistence specification. Also Oracle will develop the Reference Implementation of the persistence engine of the JEE 5 platform. As you may know you can already start to develop EJB 3.0 within the early implementation available on OTN. Note that the next release of Oracle Application Server 10g (10.1.3), EJB 3.0 will be supported.
- As you may have seen some weeks ago, Oracle is also the lead in the Eclipse project to implement the EJB 3 tool.
- Also still around Eclipse, Oracle, most successful player around BPEL, will continue the development of the BPEL deigner inside Eclipse and put that officially in the Eclipse Project. If you are not familiar with BPEL, I will invite you to jump to the OTN Web Site.
- Last, but not least, Oracle JDeveloper is now free...
Monday, June 27, 2005
JavaOne Day 1: What do to today?
- Next-Generation Web Services in the Java™ Platform (TS-7230 / 2:15pm)
- Groovy = Java™ Technology+ Ruby + Python for the JVM™ (TS-3402 / 3:30pm)
- Web Services in the Real World (TS-3999 / 4:45pm)
- Java Web Services Development Using Annotations (TS-7964 / 6:00pm)
- Writing Performant WSDLs to Build Enterprise Web Services Applications (BOF-9213 / 7:30)
- OC4J: Meet the Developers (BOF-9024 / 9:30pm)
- Ensuring 100% Application Portability with J2EE (BOF-9030 / 10:30pm)
Also I think the opening Sun's Keynote from 8:30 to 11:00 am will be I am sure a good starting point for this week !
Busy day isn't? (I am on duty the morning, will try to go to afternoon sessions...)
Sunday, June 26, 2005
JavaOne: Oracle activities
Friday, June 24, 2005
Google Code: AJAXSLT
Tuesday, June 14, 2005
Thanks to MozBackup...
Monday, June 13, 2005
Pushlets are adapting AJaX
Back in consulting I did some small projects using the Pushlets framework. A nice and simple solution to create easily Web eventing applications...The Pushlet team has created a small demonstration of integration of Pushlet and XMLHttpRequest together...
If you never used Pushlets, take a look to it it is really nice!
Thursday, June 9, 2005
Summary of Ajax frameworks
Wednesday, June 8, 2005
JSR 198 Early Draft Open For Review
Monday, June 6, 2005
Steve Jobs' Keynote...
Today is an important day. We’ve got some great stuff for you today.Here we go, WWDC 2005 has started, and as usual it is hot! You can have a summary of Steve Jobs' keynote on Macworld Web site. I think the most breaking news, beside the good numbers is the confirmation of the fact that "Apple drops IBM PowerPC line for Intel chips"... What do you think? I am personally happy; this will stop the 'useless' discussion about the speed of the chip of PC versus Mac... and, I am optimistic on the fact that Macs will be faster ;-) For me the chip is not important since the only code that I write on Mac is Java based, and little bit of AppleScript... I am impatient to see the new stuff that Apple will put in Leopard...
Sunday, June 5, 2005
Apple on Intel.. Xbox on PowerPC is the world getting crazy
Friday, June 3, 2005
"Scripting: Higher Level Programming for the 21st Century" paper from John K. Ousterhout
A scripting language is not a replacement for a system programming language or vice versa. Each is suited to a different set of tasks. For gluing and system integration, applications can be developed 5-10x faster with a scripting language; system programming languages will require large amounts of boilerplate and conversion code to connect the pieces, whereas this can be done directly with a scripting language. For complex algorithms and data structures, the strong typing of a system programming language makes programs easier to manage. Where execution speed is key, a system programming language can often run 10-20x faster than a scripting language because it makes fewer run-time checks.
Sunday, May 29, 2005
Good Bye JAX-RPC, weclome to JAX-WS
The JAX-RPC name, which stands for Java API for XML-based RPC, is misleading because developers assume it is only about RPC, according to Doug Kohlert, a Sun staff engineer, in his blog this week. “By renaming JAX-RPC to JAX-WS, we can eliminate this confusion,” Kohlert wrote. JAX-WS stands for Java API for XML Web Services.This infoworld article will give you more details.
Saturday, May 14, 2005
Leaving for India...
Thursday, May 12, 2005
Oracle SQL Developer Express
Monday, May 9, 2005
Web UI: What's behind AJAX? Simple use cases using XMLHttpRequest
If the term Ajax is relatively new, the technologies used are quite old now. And you do not need anything new to be able to leverage this approach in your current development, and since it is mainly a client (browser) based technology this can be used whether you develop your application in Java, PHP, or or even PL/SQL for the Web. In the same time, you do not want to have to develop too much of the client side to handle user interaction, this is where new frameworks that provide support of this technologies, let's say AJAX based, are very interesting. It is now possible to create very interactive Web application without passing 80% of your time in the client side development - that could be generated from your server obviously.
In the same time, before adopting such framework, it is important to understand what is happening. This is why I am creating this quick introduction based on 2 simple use cases:
- loading message: you often want to provide some feedback to your user when your browser is processing some data
- dependent lists: how you can easily create dependent lists, in lot of application you want to drive a selection list from another
If you have tested my sample on Safari, you can see that the first request works, but following subsequent requests do not, on work around is to modify the HTTP header adding the following value, has to be done before the send, just send a old date...
httpRequest.setRequestHeader('If-Modified-Since','Sun,3 Jun 1973 00:00:00 GMT');
What do you need to know?
The first interesting part is the object XMLHttpRequest. This object is currently supported by most of the browsers. As usual with HTML and Javascript the cross browser/platform testing is one of the most important part of your project. XMLHttpRequest is not new since Microsoft has implemented it in Internet Explorer 5 as an ActiveX object. Also it has been later on integrate as a native component into Mozzila and Netscape (7.0), and into Apple Safari. If originally this object as been created to load data, as XML in the background, you can using it to load any data.
Creating XMLHttpRequest Object
As usual with Javascript, it begins with interoperability issue ;-), since in the MSFT world the XMLHttpRequest is implemented as an ActiveX and in the other world(s) it is an native object, you have different ways to create the object. The idea is too test if the current browser supports or not the object and depending of the result create the object.if (window.ActiveXObject)Note: another way of choosing which code path to use depending of the version of the browser is to use conditional compilation for the Javascript engine.
{
// Microsoft Way
httpRequest = new ActiveXObject("Microsoft.XMLHTTP");
}
else if (window.XMLHttpRequest)
{
// Others...
httpRequest = new XMLHttpRequest();
}
Also I would add that it is probably good to provide a degraded version of your application if you can not control which browser will be used by your client, or if you want to provide that to mobile people. This is for example what Google Mail is doing with its Basic HTML view.
Retrieving the data asynchronously
One of the most interesting features of the XMLHttpRequestObject is the fact that you get data from a URL in the background of the user activity. This is how you can give lot of interactivity to your applications.httpRequest.open("GET", "./getEmployeeList?deptno=10", true);
httpRequest.onreadystatechange= function () {processRequest(); } ;
httpRequest.send(null);
The open method sets the different values that will be used by your request, such as the type of request, the URL, if it is synchronous or not.
The "magic" comes from the onreadystatechange property. This propery set an handler that will be called when the property readyState changes, when the request is sent, loading, or completed... Meaning, this is in this event handler, the processRequest method in the sample, that you test if the response has been completed correctly, and process the data.
Note: even if it is possible, I do not think that you should use the XMLHttpRequest in a synchronous mode since it will freeze the browser of the user, for the duration of the request.
Processing the response
As I said above the magic happens in the event handler associated with the state of the request. Let's see how you manipulate the request and response:function processRequest()The readyState propery is used to know if all the data of the response have been received or not, the different value for the state are:
{
if (httpRequest.readyState == 4)
{
if(httpRequest.status == 200)
{
// process data as XML
httpRequest.responseXML;
// or Text
alert(httpRequest.responseText);
}
else
{
alert("Error loading page\n"+ httpRequest.status +":"+ httpRequest.statusText);
}
}
}
- 0 : uninitialized
- 1 : loading
- 2 :loaded
- 3 : interactive
- 4 : completed
Then you can treat the response as XML using the responseXML, in this case you can manipulate the XML using the client DOM API. But you can also directly take the content as a string using the responseText property.
Manipulating the Data
You now have the data back from the request, as Text or XML, you just need using Javascript manipulate them and copy then into some part of your page. So all is based on the client side. Let's do a very simple example before moving to the use cases:What is happening?
Since I have explained the call above, here is the simple code that is used to copy the content from the XMLHttpRequest object to the page:
.....Most of the time, if you do not use XML you just have to copy the content of the result into a section of your page, so to do it you use:
if(httpRequest.status == 200)
{
var contentViewer = document.getElementById("contentViewer");
contentViewer.innerHTML = httpRequest.responseText;
}
....
- create a DIV tag in your page with a specific id. (or other...)
- get the object you want to copy into using the document.getElementById() method, that is the most simple way...
- then from the object just use the innerHTML property that represent the content of this DIV object. (You can also use the DOM API, to do the same thing, I am sure puris will say that this is the only way to do it correctly... )
Usecase 1: Loading Message
One common use case is to be able to have some feedback during processing of a request. Using the same approach you can print a message until the response is completely done.What is happening?
The tip here is just to take a zone where you want to print the status ("Loading..." for example). When the XMLHttpRequest status is different than 4 (completed) just print the status in this section using for example the innerHTML property. When the request is completed, just move the content of this zone to blank, or in our case the result of the request is printed into it.
....
if (httpRequest.readyState == 4)
{
if(httpRequest.status == 200)
{
// print the content of the page
var contentViewer = document.getElementById("contentViewer");
contentViewer.innerHTML = httpRequest.responseText;
}
}
else
{
// Print the loading message....
var contentViewer = document.getElementById("contentViewer");
contentViewer.innerHTML = "<b style='color:red;'>Loading....<b>";
}
...
Usecase 2: Dependent Lists
In lot of applications, you have submission form when one drop down list is controlled by another one. You have several way to support that depending of the size of your data set. For example you can download all the records (master and detail) and use some client side programming to refresh the content of the detail list depending of the value selected in the master one; or another solution is to just reload the page.Using XMLHttpRequest, you can now just call the server to populate the values of the detail list when the user select another value in the master list. (and you can implement a client side cache if you want to avoid a second call with the same parameters, but this is another story...)
What is happening?
Nothing more complex than in the previous examples, on the onChange of the master list (dept in the example) , you call a Javascript method that create the XMLHttRequest, with the correct parameter.
Then in the event handler of this request, you populate the data as XML and add them to the detail list (emp in the example).
In this specific example I used XML, but if you want for simpler code you can write all in HTML and use the innerHTML property, but this is just a choice of implementation isn't?
Summary
First of all, you have seen that what we have behind AJAX is not just new technologies. The technologies exists now for a while, they have been exposed to the masse by Google, MSN, and other Web sites. The term itself is definitevely a recent one...
Also, I have showed you simple examples that can help you for your current developments, but you need to write some code on the client. The real future of AJAX, is when this is bundle into a framework, into the Faces components your are using. So before starting to implement such code in your application you should take a look around to see if any solution exists that can answer your need...
You can download the source of the demonstrations here. I tried to keep the code as simple as possible by providing all the source in each single html file.
Tuesday, May 3, 2005
Which kind of developer are you? A software terrorist?
Thursday, April 28, 2005
J2EE application development for Forms and Designer developers
Web Services and SOA Web Site
I was yesterday talking to a customer about Web Services and Services Oriented Architecture, and he was looking for more information. So I shared with him one of my bookmark.
http://www.service-architecture.com/ is a Web site dedicated to WS and SOA with lof of articles that defines for example most of the WS-* acronyms.
Tuesday, April 26, 2005
A very good HTML Editor... and open source
- Multi Plaform: MacOS X, Linux, Windows... the project has been started by LinSpire... so not a big surprise
- FTP Site manager
- Good CSS Editor and Integration to the HTML Editor
- Form Editing
- Based on Gecko
Thursday, April 21, 2005
Mike Keith Blog: The EJB 3.0 Hibernate Fallacy
Tuesday, April 19, 2005
Free Subversion Online Book
Tuesday, April 12, 2005
Infoworld about OracleAS 10gR2: Write once, run everywhere -- no kidding
|
As you can guess, when you work on a product it is always a pleasure to see good feedback, from end users, or from the media... Tom Yager, from InfoWorld has published an article about Oracle Application Server 10g R2. |
Infoworld ©
|
Here some of the comments:
“I’m extremely impressed with AS 10g Release 2 as a commercial product. Oracle has designed a valuable feature set built on top of J2EE 1.3, optimizing it for SOAs (service-oriented architectures), BPEL (Business Process Execution Language), BPM, pervasive support of XML, and real-time business intelligence, among many, many other things.”
“But I’m just as impressed with the clear emphasis Oracle has placed on complying not only with the letter of Java server standards, but with their “write once, run anywhere” spirit. You get to choose whether you want to bind yourself to Oracle’s extras. AS 10g Release 2 permits, and even automates, deployment to and management of non-Oracle Java app servers that adhere to the J2EE 1.3 standard. And if you do this, there are no subtle glitches meant to prod you toward paying for Oracle’s server.”
“After several weeks of living with AS 10g Release 2, I found that Oracle’s added value is nothing short of spectacular for enterprise applications and well worth paying for.”
“The myth of “write once, run anywhere” has been turned on its head. With AS 10g Release 2, Oracle has delivered on that age-old promise as well as a software giant can.”
Feel free to drop me comments about your experience with OracleAS 10g...
Friday, April 8, 2005
JavaPolis Survey: Which Persistence...
Wednesday, April 6, 2005
yagoohoogle : the best of both world.. in a simple way
Thursday, March 31, 2005
Simplified Development using EJB 3.0: Raghu Kodali tested it for us
Monday, March 28, 2005
What to think about all the Ajax noise?
In the last 2 months the blogosphere has been very verbal about Ajax technology that describe a way of doing Rich UI using DHTML, Javascript and XML over HTTP. If you are not already familiar with the concept the article "Ajax: A New Approach to Web Applications" by Jesse James Garrett is a very good introduction.
For me, it is the first time that finally we have something really new in term of UI that is compliant with most of the modern architectures that are server side Java based. You can argue that Flex, OpenLazlo, ..., are very good and powerful, but first of all they use a proprietary plugin and really integrated with the development approach that most of the Java developers are currently using (MVC based on Struts, JSF or others). What get me very excited about Ajax is the fact that finally we can see Web Development giving an easy and standard/open way of creating rich client.
If you search around Ajax your will see that more and more framework are providing integration of Ajax technologies into their solution. What I see as the biggest move is the adoption of Ajax by JavaServer Faces, and simply because it is the J2EE standard for Java Web Development. I am sure that lot of you will say that Tapestry,ROR and other existing frameworks are providing the integration now, so why bother with JSF... Hmmm, I will say that all the current solution as still geek oriented and really focus on the core developers... What I see with JSF/Ajax integration is finally enterprise developers, that are used to 4GL development tools, (where the most important part is to develop business logic not a nice framework or a new set of libraries) will be able to develop Web Applications based on components that are smart enough to give the usability of a desktop application.
To give an idea of what I mean, you can take a look to Oracle ADF Faces components some of them are really powerful and provide rich interactivity to the user. One example is the Oracle Table Component that support pagination (next/previous) without refreshing the whole page. As a developer you drop the component on your page, set the properties, and done! You do not have to care about any HTML or Javascript coding. And this using a standard based faces components that you can use in any Web Container and even IDE. I know that the ADF Faces components are not using the sames stack as Ajax (eg: XML over HTTP) but this is just an example of what will be the experience for a developer and a user.
Sunday, March 27, 2005
New Oracle Products on OTN
Oracle BPEL Process Manager 10.1.2 Beta-3 Preview
BPEL PM 10.1.2 Beta 3 is now available on OTN. One of the biggest new, is the fact that the BPEL Designer is now based on Oracle JDeveloper and provide much more functionnalities than previous release.
Oracle Drive Preview Release
Oracle Drive Preview Release is a powerful WebDAV client that allows Portal content management and publishing directly from your Windows Desktop; Key Highlights:
- Mount the Portal Repository as a Windows Drive
- Get Portal specific menu options to set properties, ACL information, preview content and pages, etc
- Access the Portal repository with a command line utility
- Search from your Windows Explorer
- Perform Virus check on the Portal Repository
- Work with offline content and synchronize when online
- Edit content with any available Editor
Saturday, March 26, 2005
PHP on OC4J??? Yes with JSR 223 RI
In this entry I am explaining how to use the JSR-223 Reference Implementation into Oracle Containers for J2EE (OC4J).
Note: I have done this only on Windows XP Platform, I did not test on Unix/Linux yet.
1-The first thing to do is to download the JSR-223 Reference Implementation from the JCP Web site.
2- Unzip the sjp-1_0-ea-windows-i586.zip in a directory let say d:\java\jsr223-ri.
3- You can choose here to do a proper installation (requires perl) or not. The *proper* installation preconfigure Apache Tomcat and the JSR-223 command line demonstration. Since what we are trying to achieve is to install the RI inside OC4J you do not need to do the installation.
4- Download this zip file that contains a Ant task and various files to configure and deploy the JSR223 sample into OC4J.
4.1 To execute the Ant script you must start to set the following environman variables:
- JAVA_HOME that points to the JDK home
- ORACLE_HOME that points to the OC4J home (eg: d:\oracle\oc4j)
- JSR223_HOME that points to directory where you have unzipped the JSR223 RI (eg d:\java\jsr223)
4.2 Create a startup script for OC4J using the command
antThe default target create a script names start-jsr223.bat in the %ORACLE_HOME%\bin directory. This script set various environment variable and start OC4J with the correct system parameters to load correctly the PHP scrip engine from Java.
4.3 Start OC4J using the created script
%ORACLE_HOME%\bin\start-jsr223.bat
4.4 Package and Deploy the Sample Application
ant deployThis target packacge the Web samples from the reference implementation in a ear/war file, modifying the web.xml to define the different servlet mapping needed by JSR223.
5 Use the sample application
http://localhost:8888/jsr-223
You can start to use PHP in OC4J ;-) Take some time to read the sample code and specifications. JSR-223 is not only for Web container but also for JS2E, it is so interesting that the JSR-223 will probably be part of Mustang...
Wednesday, March 16, 2005
Blog Beginner: check out w.bloggar and other desktop tools
What blog software do you recommend if somebody is starting newly, should have the ability to create categories, easy image uploading?
I did not understand immediately his question, but he wanted to know if some Desktop application exists to easily publish on a blog...
I am sure that you can find a lot on the Web, I personnaly use w.bloggar. As you may know most of the Blog (server) provides XML-RPC, it is how this tools communicate with your server
I will have to test these tools on my Mac: BlogApp and iBlog. If you are Linux user take a look at: BlogniX
Here the list of the supported online services and blog supported by w.bloggar:
Blog Services
|
Blog Tools |
Tuesday, March 15, 2005
JavaWorld Article: Choosing a Java scripting language
Friday, March 4, 2005
Great News ! OracleAS EJB 3.0 Preview is available
Thursday, February 24, 2005
Oracle and PHP
can I use PHP with Oracle?
Sure you can!
And a very good source of information about PHP and Oracle is the OTN Web site itself, and especially the OpenSource page. Here a list of my favorites:
- Get Started with Oracle and PHP
- Installing Oracle, PHP, and Apache on Linux
- An overview on globalizing Oracle PHP Applications (PDF)
- Generic Oracle and PHP FAQ
- Oracle PHP Troubleshooting FAQ
- PHP OTN Forum
Sure! Not only you can access the Oracle database from a PHP Application, but also if you are running Oracle Application 10g the usage of mod_php is supported with Oracle HTTP Server see: And what about development?
Development could be done inside Oracle JDeveloper 10g using the The Oracle JDeveloper 10g PHP Extension
Thursday, February 17, 2005
BPEL: Edwin answer to Dutch'Rant post
Tuesday, February 8, 2005
JSR 223: Public Review of the Specification
Tuesday, February 1, 2005
JavaWorld Article: Event-driven services in SOA
Sunday, January 23, 2005
uConnect, my best Blue Tooth experience.. so far...
Monday, January 3, 2005
First 2005 resolution: make a donation for South Asia
So think about it and take five minutes of your time to make a donation to one of this organization:
- American Red Cross International Response Fund
- AmeriCares South Asia Earthquake Relief Fund
- Direct Relief International International Assistance Fund
- Médecins Sans Frontières International Tsunami Emergency Appeal
- Oxfam Asian Earthquake & Tsunami Fund
- Sarvodaya Relief Fund for Tsunami Tragedy
- Save the Children Asia Earthquake/Tsunami Relief Fund
- UNICEF South Asia Tsunami Relief Efforts
