As you know, the Service-Oriented Architecture (SOA) promotes reuse, and sometimes you need to expose some methods inside your ADF application as web services. This way, these web services can be consumed inside a BPEL Composite or OSB Proxy Service. Using the ADF Developer’s Guide documentation (15 Creating SOAP Web Services with Application Modules), let’s expose the Application Module as a SOAP Web Service.
Download the sample application: ADFAppModuleServiceApp.zip.
Configuring the Application Module
In your Model Project, double-click the Application Module.
In the overview editor, click the Web Service navigation tab and then click the Enable support for Service Interface (green plus icon).
The Create Service Interface wizard is showed.
In Step 1, you can change the name and target namespace for the web service. The Generate Asynchronous Web Service Methods option exposes the methods of the application module as asynchronous service methods, enabling both synchronous and asynchronous operations on the web service.
In Step 2, you can select some built-in methods to expose.
In Step 3, if you have created a custom method on Application Module and want to expose it, select it here.
In Step 4, move the EmployeesView1 for the selected box.
Enable the Create and GetByKey operations and change the names of methods to createEmployees and getEmployeeById.
Click Finish to create the service interface.
JDeveloper generated class service interface.
To run using Integrated WebLogic Server
In your Model Project, expand the Application Module, expand the serviceinterface node, and then select the service implementation class (AppModuleServiceImpl.java) file. Right-click the service implementation class file, and choose Run.
To deploy to Oracle WebLogic Server
Double-click the Model Project to open Project Properties wizard, select the Deployment node and click New Profile icon.
In the Create Deployment Profile wizard, choose Business Components Service Interface as the archive type, change Deployment Profile Name to AppModuleServices, and click OK twice.
In the main menu, choose Application > Deploy > Model_AppModuleServices to open the Deploy Model_AppModuleServices wizard.
On the Deployment Action page, select Deploy to Application Server and click Next.
On the Select Server page, select the application server connection and click Finish.
Testing the Web Service application
In the main menu, choose Tools > HTTP Analyzer.
In HTTP Analyzer window, click Create New SOAP Request (paper icon).
Go to WebLogic Server Log window and copy the target URL.
Click Select WSDL button, paste the target URL adding ?WSDL at the end and click OK.
In Operations, choose createEmployees, provide values for input arguments and click Send Request button to create an employee.
Now, choose getEmployeeById, provide value for input argument and click Send Request button to get the employee by ID.
This is the result on database.