Exposing Web Services From Business Components

Exposing Web Services From Business Components

     Each new line of code you write is a potential bug. Moreover, each line of code you add to your existing applications reduces your ROI. On the other hand, service integration is more important today than ever.

Did you know that you can leverage the Oracle ADF applications 642-384 you already have to build web services? This blog is going to explain this process.

The Pattern   

First of all, let me describe a pattern that can be useful when exposing BC’s as web services. That pattern is called “Facade” and it is commonly used with object-oriented programming. This pattern will help us to preserve the tuning which is made to the VO’s for better performance and will help us to separate the web service logic where we can have different tuning more suitable for the needs of the exposed web services.

In the “Facade” we aim to reuse code and to separate from the business logic that is why there are no entity objects. The view objects in the “Facade” do not expose the view objects from the library directly. They need to extend the view objects from the application module library or offer new view objects for operations that are accessible only for the web consumers and not from the web interface.

Way of implementation

There are two dominant styles of building a web service either with SOAP or REST. Currently, version 11g of JDeveloper offers a straightforward method for implementing SOAP web services from BC’s. If you want to use REST you have to build a large part of the code on your own, however in future releases of JDeveloper and ADF there will be REST support. In this post, we will focus on the SOAP style for exposing application module as web service.

  1. First we must create the ADF library from the existing application module in order to reuse the EO’s and VO’s in our web service part. We must ensure that we have a database connection and that the model project uses it.

  • After we are sure that we use the connection we must create a deployment profile for our ADF library.

  • In the profile, we must ensure that all dependencies and connections are included.

  • We deploy the ADF library and then we create a new file system resource in the IDE from this .jar file.After we click “OK” button the resources should be available in the resource tab in JDeveloper.

    2.  Creating the service project. For this project, we will use generic project and we will add Business Components, Web Service and XML technologies in it.

  • After we created the project we must include the already created ADF library in it, so we can reuse the existing Business Components.

  • When the library is included we must provide a password for the connection because it is not stored in the jar file for security reasons.Also, make sure that the new project uses the connection. This can be observed in the project properties under Business Component

  • After all these steps are done we can create the needed view objects by extending the ones in the ADF library. If we create new business logic then we create new view objects based on the entities from the ADF library.

  • Then we can create the SDO objects for the VO’s that we added.However, this step can be committed because when adding the VO’s to exposed application module these files will be created automatically.

  • The application module, in this case, is the web service endpoint. And we can group the view objects in different application modules according to their functional fitness. For these application modules, we can have different fine tuning. To expose the application module as web service, we must go to service interface tab and click the green plus. From there we can choose which view objects to be included and we can create meaningful names for their methods.

  • The only thing left is to create a deployment profile for the exposed web service module. Here we must choose business components service interface.

  • We can customize the URL of the web service from the project properties this is the context-root of the Java EE application.


I plane to post a blog about Creating custom web services from application module which will be linked with 642-414 Exam


Denis Danov

Java EE and Oracle Developer at Dreamix

More Posts - Website

Follow Me:
TwitterLinkedInGoogle Plus

Do you want more great blogs like this?

Subscribe for Dreamix Blog now!