jDeveloper: Create and deploy a Java Webservice

jDeveloper: Create and deploy a Java Webservice: "This tutorial shows how to create a simple Java Webservice using the Oracle jDeveloper 11g IDE. The attached code for the example connects to a database through JDBC and executes a SQL statement to insert a new row in a specific table.

Once the application has been configured, it will be deployed and tested in a Oracle Weblogic Server. We will execute the webservice through a web browser and check it by connecting to the database with a sqlplus console.

Step-by-step:
1) Create a generic java application and add the webservice component

2) Create a new java class and add some methods to publish. Here you have an example:
NOTE: Remember to adapt this code to your requirements.

public void InsertValue(String user, String value){
try{
//Example from http://studentsatoracle.blogspot.com
Connection con=null;
Class.forName('oracle.jdbc.driver.OracleDriver');

//Configure the jdbc connection: jdbc:oracle:thin:@host:port:SID,username,passwd
con=DriverManager.getConnection('jdbc:oracle:thin:@localhost:1521:owcdb01', 'DEV_WEBCENTER','welcome1');
Statement s = con.createStatement();
//Configure the SQL query as you want, the table must exists
s.execute('INSERT INTO DEV_WEBCENTER.uservalues (ID,USERNAME,INSERTDATE,VALUE) VALUES (DEV_WEBCENTER.uservalues_seq.nextval,''+user+'',To_char(SYSDATE),'+value+')');
s.close();
con.close();
}catch(Exception e){
System.out.println('ERROR: '+e.getMessage());
}
}


3) Configure the webservice and publish the desired methods

4) Deploy the application. You can follow this guide to create a deployment profile: http://studentsatoracle.blogspot.com/2011/02/jdeveloper-how-to-deploy-application-to.html

5) Open a Weblogic Server console and test the application

Documentation:
Oracle's official documentation for jDeveloper 11g

Downloads:
Oracle jDeveloper 11g

Viewlet:
(Duration: 3 min.)
"

Comentarios

Entradas populares de este blog

Buscar la sesión por PID y ver la query SQL en Oracle

Como mover un indice de tipo LOB a un tablespace diferente

Eliminar procesos MySQL que están en estado SLEEP por determinado tiempo