create rest webservice for oracle public api using java class via jdeveloper

Post on 09-Feb-2017

94 Views

Category:

Education

3 Downloads

Preview:

Click to see full reader

TRANSCRIPT

Create Custom Application in Jdeveloper

Open Jdeveloper 12.1.3.0.0 or 12.2.1.1.0 -File->New->Application or New Application

Select Custom Application

Enter the Application Name

Enter Project Name and Select ‘Java’ :

Leave the Defaults:

Your Application with project would look like below, right click on the Project ‘Inv_API’ and select

New->Java Class

Enter Java Class Name and leave it as default or click on the Main method check box and press Ok

Your Java Class would be as below, add the code for invoking Oracle Public API :

Build the code required to call the Oracle Public API

After Adding the code you might see the errors with ‘OracleTypes’

Add Libraries to the Project

To get rid of the errors, add the required JAR Files. Right click on the project ‘Inv_API’ and select ‘Project Properties’ and click on ‘Libraries and Classpath’ and then click on ‘Add Library’ and add following libraries

Click on ‘Add JAR/Directory’ and add the JAR Files from your local machine

After adding required Jar and library files , click OK

Save your work

Make sure you have no Build-Issues

Create Rest Webservice

Right click on ‘Rest_Java.java’ file and select ‘Create RESTful Service’, and enter the required information

Your application with code would look like below with the annotations added automatically

Save All

Running the Integrated Weblogic Server

Right Click on ‘Rest_Java.java’ and select ‘Run’, select ‘JAX-RS Web Service Runner’

Integrated WebLogic Server gets kicked off and the following URL would be generated

Click on the Target URL, HTTP Analyzer Window opens, enter the parameters

Check the Interface table for the Transaction Interface Id

After Rest web service is run you should see the record in the base table

Testing Rest Webservice

Click on ‘Send Request’ after entering the parameters

You should see the message if the Rest Webservice is successful

Now verifying in the backend: Interface table record gets picked up

Checking the base table

top related