Database Web Service using Toplink DB Provider

Posted by Vishal Jain on Oracle Blogs See other posts from Oracle Blogs or by Vishal Jain
Published on Mon, 20 Jun 2011 03:38:26 -0700 Indexed on 2011/06/20 16:31 UTC
Read the original article Hit count: 457

Filed under:
With JDeveloper 11gR2 you can now create database based web services using JAX-WS Provider. The key differences between this and the already existing PL/SQL Web Services support is:

  • Based on JAX-WS Provider
  • Supports SQL Queries for creating Web Services
  • Supports Table CRUD Operations

This is present as a new option in the New Gallery under 'Web Services'

ToplinkDBWS_NewGallery.jpg


When you invoke the New Gallery option, it present you with three options to choose from:

ToplinkDBWS_ThreeOptions.jpg


In this entry I will explain the options of creating service based on SQL queries and Table CRUD operations.

SQL Query based Service

When you select this option, on 'Next' page it asks you for the DB Conn details. You can also choose if you want SOAP 1.1 or 1.2 format. For this example, I will proceed with SOAP 1.1, the default option.

ToplinkDBWS_DBConn.jpg


On the Next page, you can give the SQL query. The wizard support Bind Variables, so you can parametrize your queries. Give "?" as a input parameter you want to give at runtime, and the "Bind Variables" button will get enabled. Here you can specify the name and type of the variable.

ToplinkDBWS_BindVariable.jpg


Finish the wizard. Now you can test your service in Analyzer:

ToplinkDBWS_TestServiceQuery.jpg


See that the bind variable specified comes as a input parameter in the Analyzer Input Form:

ToplinkDBWS_AnalyzerQuery.jpg


CRUD Operations

For this, At Step 2 of Wizard, select the radio button "Generate Table CRUD Service Provider"

ToplinkDBWS_CRUDSelect.jpg


At the next step, select the DB Connection and the table for which you want to generate the default set of operations:

ToplinkDBWS_CRUDTableSelect.jpg


Finish the Wizard. Now, run the service in Analyzer for a quick check.
See that all the basic operations are exposed:

ToplinkDBWS_CRUDTableAnalyzer.jpg

© Oracle Blogs or respective owner

Related posts about /Oracle/Webservices