Java Cloud Service Integration using Web Service Proxy

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 to 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 Proxy will be implemented.


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 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 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

First Fusion Web Application is created and configured. Start JDeveloper and click “New Application”:

  • Application Name: JcsWsDemo
  • Application Package Prefix:
  • Application Template: Fusion Web Application (ADF)

Create Project

For clarity the web service proxy will be created in a separate project. TO create new project navigate “New -> Projects -> Generic Project”:

  • Project Name: CreditRuleServiceProxy
  • Project Technologies: Select “ADF Business Components”

Create Web Service Proxy

In this example we will use a Web Service Proxy to integrate with Credit Rule Service in Fusion Applications. The proxy will be used to create a rule in Fusion Applications using a web service call. To generate the proxy choose the “CreditRuleServiceProxy” project and navigate to "New -> All Technologies -> Business Tier -> Web Services -> Web Service Proxy":

  • On “Select Client Style” (step 2) choose “JAX-WS Style”
  • On “Select Web Service Description” (step 3) enter the following to “WSDL Document URL”: https://ic-[POD]
  • On “Policy” (step 2) select the appropriate policy, in the example case “oracle/wss_username_token_over_ssl_client_policy” is used. Note that if different policy is used there may be additional configuration required for example if the policy contains “message_protection” then certificates would need to be configured.

Click “Finish” and the proxy will be generated. Next open the file “”. Here we will implement the logic to create a rule. The dates parameters expect XMLGregorianDate so first add a convenience method to produce such date:

     * Construct a gregorian calendar date that can be used to set date
     * attributes on the data structures. Only includes the date
     * component, time component is ignored.
     * @return date in gregorian calendat format
    public static XMLGregorianCalendar getXMLGregorianCalendar(int year,
                                                               int month,
                                                               int day) {
        XMLGregorianCalendar result = null;
        try {
            GregorianCalendar cal1 = new GregorianCalendar(year,
            result = DatatypeFactory.newInstance()
        } catch (Exception e) {
            throw new RuntimeException(e);        }
        return result;

Finally add the method to call the web service using the proxy. Note that some of the values are hard coded. This is done in effort to keep the example simple, in real use case the values would be populated properly:

    public String createRule(String ruleName) {
        String result = null;
        try {
            SecurityPoliciesFeature securityFeatures =
                new SecurityPoliciesFeature(new String[] { "oracle/wss_username_token_over_ssl_client_policy" });
            creditRuleService_Service = new CreditRuleService_Service();
            CreditRuleService creditRuleService =

            // Provide the user name and credential to authenticate with
            WSBindingProvider wsbp = (WSBindingProvider)creditRuleService;

            ObjectFactory ruleFactory = new ObjectFactory();
            Rule rule = ruleFactory.createRule();

             * Hard coding the following values as they are not relevant
             * for the demo. The values are mandatory so they must be
             * provided. The orgId is specific to the environment, so if
             * copy pasting code please update the value to match your
             * environment.
            rule.setOrgId(new Long(300000000678473L));
            rule.setStartDate(getXMLGregorianCalendar(2012, Calendar.JANUARY,
            rule.setEndDate(getXMLGregorianCalendar(2020, Calendar.JANUARY,
            rule.setUsageId(new Long(-1001L));
            rule.setOrgId(new Long(300000000678473L));
            rule.setUsageId(new Long(-1001L));

            Rule newRule = creditRuleService.createRule(rule);
            result = (null != newRule ? newRule.getRuleId().toString() : null);

        } catch (Exception e) {
            throw new RuntimeException(e);
        return result;

Creating UI

Choose the “ViewController” project and navigate “New -> Web Tier : JSF : JSF Page”. On the “Create JSF Page” enter “JcsWsDemo” as name and ensure that the “Create as XML document (*.jspx)” is checked.

The rule creation logic created in previous step requires user name as a parameter. In this example for simplicity we will use a managed bean to store the value. Choose the “ViewController” project and navigate “New -> General : Java : Java Class” and create a java class with name “JcsWsDemoBean”. Add a variable to store the rule name into the class and generate accessors for it:

  public class JcsWsDemoBean {
    public JcsWsDemoBean() {

    String ruleName = null;

    public void setRuleName(String ruleName) {
        this.ruleName = ruleName;

    public String getRuleName() {
        return ruleName;

Next register the bean by navigating to “ViewController -> Web Content –> WEB-INF -> adfc-config.xml -> Managed Beans -> +” and enter the details of the java class created before.

The name will be obtained from the user; add a “InputText” and a button component into the “af:form” on the “JcsWSDemo”. For the “InputText” set the value attribute of the input text to the variable in the managed bean:
      <af:form id="f1">
        <af:inputText label="Rule Name" id="it1" value="#{JcsWsDemoBean.ruleName}"/>
        <af:commandButton text="Create Rule" id="cb1"/>
Next implement the logic to invoke the proxy. To allow the managed bean to access the proxy open “ViewController” project properties and navigate to “Dependencies -> Edit” and add the build output of the “CreditRuleServiceProxy.jpr” as dependency:

Ont the new button choose “Edit” from the choice list for “ActionListener” for the button. Choose the “JcsWsDemoBean” as the managed bean and create new method named “createRule” by clicking the “New” button:

On the “createRule” method add logic to create the rule using the proxy and to popup a message indicating the result of the call to the user:

    public void createRule(ActionEvent actionEvent) {
        CreditRuleServiceSoapHttpPortClient proxy = new CreditRuleServiceSoapHttpPortClient();
        String ruleId = proxy.createRule(ruleName);
        FacesMessage fm = new FacesMessage(ruleId);
        FacesContext context = FacesContext.getCurrentInstance();
        context.addMessage(null, fm);

Deploy to JCS

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]

The UI allows user to enter a rule name and to create rule by pressing a button. The identifier of the rule created is displayed in a popup window:


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


Post a Comment:
  • HTML Syntax: NOT allowed

Follow us on twitter Fusion Applications Extensibility, Customizations and Integration forum Fusion Applications Dev Relations YouTube Channel
This blog offers news, tips and information for developers building extensions, customizations and integrations for Oracle Fusion Applications.


« December 2015