In ADF 12.2.1, released just before OOW, many new features were introduced, and one of them is to expose ADF Business Components as REST Web Services. You can check other ADF 12.2.1 features in my ADF 12.2.1 release post.
In this post I am going to publish and secure ADF BC as REST services.
The first thing we have to do is to configure a release version for REST. You can do this in adf.config.xml file.
In previous versions we could expose BC as SOAP web services in Application Module Web Services tab, and now we can choose also REST.
We can select the view instances and set a resource name.
A xml file will be automatically created where for example we can set the attributes we want to expose and also if we want to expose any custom methods that we have created in the view implementation classes.
A new project will be also created in our application RESTWebService. This is the project we have to deploy. Simply click on the project and click on run.
If we test the service with any client tool, for example, Postman
, we can see that the service returns Departments data.
The next thing we are going to do is to secure the services. We have to configure ADF Security.
In the configuration wizard RESTWebService project must be selected.
After finishing the wizard we have to secure the resource by adding some roles or users.
The last step is to configure the rest URL pattern in web.xml file, under security tab.
Now we are ready to test. If we don’t set any authorization in the rest call we can see that a “401 – Unauthorized” is returned.
But if we configure HTTP basic authentication, Departments data is returned.