Create SOAP based Web Service from PLSQL Package

We have seen how to create SOAP based web service from java class. Here we will create web service from PL/SQL package.

Description of operations while creating web service

In this example, web service will be created based on calculator functionality. Web service will perform four operations based on four procedures in the pl/sql package. Refer this link for the package.

  1. Create a PL/SQL package in database and create database connection with the database details in the Application resources, just below the Application tab of jdeveloper 12C.Web_service_PLSQL_Package_1
  2. Right click on application name and select New -> From Gallery. Create a custom project under the same application XXTestWSAPPWeb_service_PLSQL_Package_2
  3. Enter project name XXCalcWSPrj and select a directory to store this projectWeb_service_PLSQL_Package_3
  4. Click on Finish. Now we have to create TopLink DB Web Service Provider to create a web service from pl/sql package. Right click on the project and select New -> From GalleryWeb_service_PLSQL_Package_4
  5. Select TopLink DB web Service Provider under Business Tier categoryWeb_service_PLSQL_Package_5
  6. TopLink DB web Service Provider creation wizard will openWeb_service_PLSQL_Package_6
  7. Click on Next and select Generation PL/SQL Web Service ProviderWeb_service_PLSQL_Package_7
  8. Select database connection and packageA�along with Soap VersionWeb_service_PLSQL_Package_8
  9. Then select all the procedures in the selected package which need to be exposed as operation in the service.Web_service_PLSQL_Package_9
  10. Click on Finish. Web service will be created from pl/sql package. Actually a java file will be created as calculator webservice.Web_service_PLSQL_Package_10
  11. Test the web service. Right click on DBWSProvider.java file and select Test Web ServiceWeb_service_PLSQL_Package_11
  12. Select subtract operation and enter two numbers in the request header. Click on Send Request. Response will look like below screenshotWeb_service_PLSQL_Package_12
  13. Copy the URL of this service and open it in browser. This web service can be tested in the browser alsoWeb_service_PLSQL_Package_13
  14. Select add operation and enter two numbers and click on InvokeWeb_service_PLSQL_Package_14
  15. Test result will be like below screenshotWeb_service_PLSQL_Package_15

Leave a Reply

Your email address will not be published. Required fields are marked *

Show my latest post here