Java Cloud Service Integration using Web Service Data Control

Posted by Jani Rautiainen on Oracle Blogs See other posts from Oracle Blogs or by Jani Rautiainen
Published on Mon, 26 May 2014 15:07:58 +0000 Indexed on 2014/05/26 21:51 UTC
Read the original article Hit count: 441

Filed under:

Java Cloud Service (JCS) provides a platform to develop and deploy business applications in the cloud. In Fusion Applications Cloud deployments customers do not have the option to deploy custom applications developed with JDeveloper to ensure the integrity and supportability of the hosted application service. Instead the custom applications can be deployed to the JCS and integrated to the Fusion Application Cloud instance.

This series of articles will go through the features of JCS, provide end-to-end examples on how to develop and deploy applications on JCS and how to integrate them with the Fusion Applications instance.

In this article a custom application integrating with Fusion Application using Web Service Data Control will be implemented.

Pre-requisites

Access to Cloud instance

In order to deploy the application access to a JCS instance is needed, a free trial JCS instance can be obtained from Oracle Cloud site. To register you will need a credit card even if the credit card will not be charged. To register simply click "Try it" and choose the "Java" option. The confirmation email will contain the connection details. See this video for example of the registration.

Once the request is processed you will be assigned 2 service instances; Java and Database. Applications deployed to the JCS must use Oracle Database Cloud Service as their underlying database. So when JCS instance is created a database instance is associated with it using a JDBC data source.

The cloud services can be monitored and managed through the web UI. For details refer to Getting Started with Oracle Cloud.

JDeveloper

JDeveloper contains Cloud specific features related to e.g. connection and deployment. To use these features download the JDeveloper from JDeveloper download site by clicking the “Download JDeveloper 11.1.1.7.1 for ADF deployment on Oracle Cloud” link, this version of JDeveloper will have the JCS integration features that will be used in this article. For versions that do not include the Cloud integration features the Oracle Java Cloud Service SDK or the JCS Java Console can be used for deployment.

For details on installing and configuring the JDeveloper refer to the installation guide. For details on SDK refer to Using the Command-Line Interface to Monitor Oracle Java Cloud Service and Using the Command-Line Interface to Manage Oracle Java Cloud Service.

Create Application

In this example the “JcsWsDemo” application created in the “Java Cloud Service Integration using Web Service Proxy” article is used as the base.

Create Web Service Data Control

In this example we will use a Web Service Data Control to integrate with Credit Rule Service in Fusion Applications. The data control will be used to query data from Fusion Applications using a web service call and present the data in a table. To generate the data control choose the “Model” project and navigate to "New -> All Technologies -> Business Tier -> Data Controls -> Web Service Data Control" and enter following:

  • Name: CreditRuleServiceDC
  • URL: https://ic-[POD].oracleoutsourcing.com/icCnSetupCreditRulesPublicService/CreditRuleService?WSDL
  • Service: {{http://xmlns.oracle.com/apps/incentiveCompensation/cn/creditSetup/creditRule/creditRuleService/}CreditRuleService

On step 2 select the “findRule” operation:

Skip step 3 and on step 4 define the credentials to access the service. Do note that in this example these credentials are only used if testing locally, for JCS deployment credentials need to be manually updated on the EAR file:


Click “Finish” and the proxy generation is done.

Creating UI

In order to use the data control we will need to populate complex objects FindCriteria and FindControl. For simplicity in this example we will create logic in a managed bean that populates the objects. Open “JcsWsDemoBean.java” and add the following logic:

    Map findCriteria;
    Map findControl;

    public void setFindCriteria(Map findCriteria) {
        this.findCriteria = findCriteria;
    }
    public Map getFindCriteria() {
        findCriteria = new HashMap();
        findCriteria.put("fetchSize",10);
        findCriteria.put("fetchStart",0);
        return findCriteria;
    }
    public void setFindControl(Map findControl) {
        this.findControl = findControl;
    }

    public Map getFindControl() {
        findControl = new HashMap();
        return findControl;
    }

Open “JcsWsDemo.jspx”, navigate to “Data Controls -> CreditRuleServiceDC -> findRule(Object, Object) -> result” and drag and drop the “result” node into the “af:form” element in the page:

On the “Edit Table Columns” remove all columns except “RuleId” and “Name”:

On the “Edit Action Binding” window displayed enter reference to the java class created above by selecting “#{JcsWsDemoBean.findCriteria}”:

Also define the value for the “findControl” by selecting “#{JcsWsDemoBean.findControl}”.

Deploy to JCS

For WS DC the authentication details need to be updated on the connection details before deploying. Open “connections.xml” by navigating “Application Resources -> Descriptors -> ADF META-INF -> connections.xml”:

Change the user name and password entry from:

<soap username="transportUserName" password="transportPassword"

To match the access details for the target environment. Follow the same steps as documented in previous article ”Java Cloud Service ADF Web Application”. Once deployed the application can be accessed with URL:

https://java-[identity domain].java.[data center].oraclecloudapps.com/JcsWsDemo-ViewController-context-root/faces/JcsWsDemo.jspx

When accessed the first 10 rules in the system are displayed:

Summary

In this article we learned how to integrate with Fusion Applications using a Web Service Data Control in JCS. In future articles various other integration techniques will be covered.

© Oracle Blogs or respective owner

Related posts about /Oracle