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)
You can now downlaod the Early Access 1 version of Oracle JDeveloper 10g (10.1.3) from
Oracle Developer Day
. 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.

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.