|Oracle® Fusion Applications Developer's Guide
11g Release 4 (11.1.4)
Part Number E15524-09
|PDF · Mobi · ePub|
This chapter describes what a SOA composite application needs to do to invoke logic implemented by a Java class.
When to implement: A SOA composite application needs to invoke logic implemented by a Java class.
Design Pattern Summary: The logic is accessed using a web service that the SOA composite component accesses directly. The logic can be placed within an existing ADF Business Components service, or the Java class can be published as a web service.
Business component that contains a service method, and is published as a service; or a Java class published as a web service.
SOA composite application that includes a BPEL process service component that accesses the ADF Business Components service or the Java class web service.
While the most common implementation of business logic will either be inside the application module of a business component or in a SOA composite application, Oracle Fusion applications may contain business logic implemented in a separate Java class. A SOA composite component within the application may need to access this logic. When the logic has some relation to the entity or view objects defined in a business component, it is best to implement the logic as another service method on the component. You can publish the business component as a service, and the SOA component can access the logic through that service.
In some cases, the application does not contain a business component that accesses the same data as the logic in the Java class. In this case, you can publish the class as a web service, allowing the SOA component to directly access the logic through the service.
Instead of accessing the logic through a SOAP binding, you could use a BPEL component with a Java activity to invoke some custom Java code.
An alternative is to use the
bpelx:exec command to programmatically call Java methods. This is the same as using a Java activity, only without a UI. It is recommended to use the
bpelx:exec command to complete light tasks such as the following:
Calling self-contained Java classes that do not have dependencies on other system resources.
Calling functions provided by the BPEL service engine, such as adding an
auditTrail component, and so on.
Calling Enterprise JavaBeans.
Do not use the
bpelx:exec command to access the application database or a SOAP service.
To access the application database, use a JCA database adapter. To access a SOAP service, use a BPEL Invoke activity.
For more information about using the
bpelx:exec command, see the chapter "Incorporating Java and Java EE Code in a BPEL Process" in the Oracle Fusion Middleware Developer's Guide for Oracle SOA Suite.
Another alternative is to call custom Java classes using custom XPath functions. For more information about using XPath functions to call a Java class, see the sub-section "Creating User-Defined XPath Extension Functions" in the appendix "XPath Extension Functions" in the Oracle Fusion Middleware Developer's Guide for Oracle SOA Suite.
Download the sample code for this use case from the following location. Oracle SOA Suite samples.
Instead of directly accessing the Java class, you can add the logic to a business component and then publish the business component as a SOAP service. The SOA composite application component accesses the ADF Business Components service, which in turn invokes the Java code.
To use a business component:
Create a business component, including the required logic as a method on an application module, as documented in the section "Part II: Building Your Business Services" of the Oracle Fusion Middleware Fusion Developer's Guide for Oracle Application Development Framework (Oracle Fusion Applications Edition).
Generate the service interface for the business component and from the SOA component, invoke the service through a SOAP binding, as described in Chapter 35, "Orchestrating ADF Business Components Services."
You secure this design pattern in the same way as you secure a pattern that has an ADF Business Components service invoked from a SOA composite application. For details, see Section 35.5, "Securing the Design Pattern."
To properly verify this design pattern, you should test your business component, then deploy and test the SOA composite application.
To verify this design pattern:
Test your Oracle ADF application using various testing and debugging methods described in the chapter "Testing and Debugging ADF Components" of the Oracle Fusion Middleware Fusion Developer's Guide for Oracle Application Development Framework (Oracle Fusion Applications Edition). For information about testing the ADF Business Components service, see the chapter "Integrating Web Services Into a Fusion Web Application" in the Oracle Fusion Middleware Fusion Developer's Guide for Oracle Application Development Framework (Oracle Fusion Applications Edition).
Deploy the SOA composite application to the standalone WLS where the SOA infrastructure has been installed. Because you created a published event from the SOA composite application to the ADF Business Components service, the ADF Business Components service need not to also be deployed to the SOA infrastructure.
Test the deployed SOA composite service using Oracle Enterprise Manager Fusion Middleware Control Console. Every deployed service has its own test page, so you can quickly test that the service functions as you expect. For more information about using the Fusion Middleware Control Console to test deployed SOA composite applications, see the following chapter:
"Automating Testing SOA Composite Applications" in the Oracle Fusion Middleware Developer's Guide for Oracle SOA Suite.
Following are tips that may help resolve common issues that arise when developing or running this use case.
When writing custom Java code, you may need to use logging messages for debugging. You can then monitor the log files for troubleshooting information.
For more information about testing and debugging, see the following chapter:
"Testing and Debugging ADF Components" in Oracle Fusion Middleware Fusion Developer's Guide for Oracle Application Development Framework (Oracle Fusion Applications Edition).
If you have already created a business component and the method semantics of the needed logic fit with the other service methods already implemented in the application module, you should add another method for the needed logic to the application module. If the method relies on entity and or view objects on the business component, then adding the method to the business component is the only approach available.
If you have not created a business component or the method semantics do not fit with the other service methods already implemented in the application module, you may want to create a Java web service instead.