Thursday, December 22, 2005

SearchWebServices: Oracle's Steve Harris on Java and standing out in SOA, part 1

Interested to know more about the Oracle Application Server 10g and the SOA/Java strategy? Take some time to read the SearchWebServices.com interview with Steve Harris, VP of the Java Platform Group at Oracle.     Oracle's Steve Harris on Java and standing out in SOA, part 1 Addition on 30/12: follow TheServerServide discussion

Tuesday, November 22, 2005

Oracle 10g: Oracle Open World Top 10 presentations

You can find online the top 10 presentations of Oracle Open World 2005:

1. Optimizing the Optimizer: Essential SQL Tuning Tips and Techniques
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
Enjoy!

Friday, November 11, 2005

Using Eclipse WTP and OracleAS/OC4J

You have probably heard about Web Tools Platform (WTP), this project extends Eclipse with various tools for developping J2EE applications. It contains editors for HTML, JSP, XML and so more... In addition to various wizards to create Web Services, EJB, Connector and more... WTP allows developers to package the application using J2EE standard packagind: EAR,WAR,RAR,JAR and deploy and run the application from the IDE.

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, ...


Supported Server
click to enlarge

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:
  1. Download and install Eclipse WTP 1.0M8 from Eclipse site.
  2. Download and install OracleAS 10g (OC4J 10.1.3 Developer Preview 4) from OTN
  3. You must set a administrator password for OC4J using the start command
  4. 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.

OC4J configuration
Update (Nov,18) : I forgot to mention the Oracle Application Server Adapter tutorial from the Web Tools project.

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
where blojsomXXXX is the name of the Web application generated during deployment.

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?
Are Web Services are mature enough?
I think that is a very interesting and valid question. The answer is certainly: 

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

This morning I have been talking about the Oracle Database and Web Services. If you are Oracle 10g developer (Database or Application Server) you probably already know that you can publish PL/SQL stored procedure as Web Services... One of the new feature of our OracleAS 10.1.3 release is the fact that now you can publish SQL and DML as well. In this post I am quickly explaining the basic steps to publish a query 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 -help
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
As 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.

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 -sqlAssemble
                       -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
So 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.


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-application

> 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
Also 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.

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:
  1. A client is sending a request to the server using SOAP. So it uses the different typed as defined in the payload
  2. The JAX-RPC Servlet processes the request and deserializes the message
  3. The generated classes use the OC4J DataSource to connect to the database and execute the statement using JDBC
  4. 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.