Integrating With Fusion Application Using Services (Ruby)

Fusion Applications provides Web services that allow external systems to integrate with Fusion Applications. There are two types of services: ADF services and composite services. ADF services are created for a logical business object and provide functionality to access and manipulate these objects. The composite services are mostly process oriented and provide an orchestration of multiple steps.  

Information about the web services provided by Fusion Applications is hosted in Oracle Enterprise Repository (OER). The information provided by OER can be used to understand the functionality provided by the service and how the service can be called. 

This series of articles describes how one can invoke SOAP web services provided by Fusion Applications using various technologies. In this article we will cover how to invoke a Fusion Application web service using Ruby on Rails.


There are various frameworks available, in these examples we will use Savon and basic "net/https" call. In order to build the application you will need to install and configure "Ruby on Rails" development environment. The reader is expected be familiar with the "Ruby on Rails" and as such the details on creating the development environment and basic development are not covered. On high level to create the development environment you would follow these steps:

Implementing Web Service Call

Details for creating the base application details are not provided, the high level steps are:

  • Create application (rails new WsTest1)
  • Create controller (rails generate controller WsCallSample WsCall)
  • Set the root (remove public/index.html and modify the root property in config/routes.rb to 'WsCallSample#WsCall')
  • Add Savon to the application (Add "gem 'savon'" to app/Gemfile)

Next we will create a HTML form (in the example application under views/ws_call_sample/WsCall.html.erb) that allows user to enter the payload to be passed to the service, button to invoke the processing for Savon, button to invoke the processing for "net/https" call and text to display the results:

<form name="envelope" method="POST">
  <input type="hidden" name="INPUT_PAYLOAD" >
  <input type="hidden" name="OUTPUT_PAYLOAD" >
   <%= submit_tag "Invoke Savon", :name => "invokeSavon" %>
  <%= submit_tag "Invoke HttpRequest", :name => "invokeHttpRequest" %>
  <table style="width:100%; font-size: small;" align=center>
      <td  align="left"><b>Input Payload</b></td>
      <td  align="left"><b>Output Payload</b></td>
      <td align="center"><textarea name="inputpayload" wrap="off" style="width:100%;height:100%" rows=30 ><%= params["inputpayload"] %></textarea></td>
      <td align="center"><textarea name="outputpayload" wrap="off" style="width:100%;height:100%" rows=30  ><%= params["xmlbody"] %></textarea></td>

Next  we update the controller (in the example application under controllers/ws_call_sample_controller.rb) to handle the submissions from the form:

require 'rubygems'
require 'nokogiri'
require 'rexml/document'
require "net/https"
require 'uri'
class WsCallSampleController < ApplicationController
  def WsCall
    username ="username";
    password ="password";
    if params['invokeSavon']
      # Process submission when the invokeSavon button was pressed
      url = "https://host:port/icCnSetupCreditRulesPublicService/CreditRuleService?wsdl";
      # Create new instance of the Savon client using basic authentication
      client = Savon.client(wsdl: url, basic_auth: [username, password], ssl_verify_mode: :none )
      # Call the service with the envelope provided as input
      response =, xml: input)
      # Parse the response to XML
      doc = Nokogiri::XML(response.to_xml  ,&:noblanks)
      s = doc.to_xml( indent:2, indent_text:" " )
      # Populate reponse content to a variable to be displayed on the output area
      params["xmlbody"] = s
    elsif params['invokeHttpRequest']
      # Process submission when the invokeHttpRequest button was pressed
      uri = URI.parse("https://host:port/icCnSetupCreditRulesPublicService/CreditRuleService")
      # Create new instance of HTTP object
      http =, uri.port)
      # The request uses SSL, certificates are NOT verified
      http.use_ssl = true
      http.verify_mode = OpenSSL::SSL::VERIFY_NONE
      # Create new instance of HTTP POST request
      request =
      # Configure the request content type to be xml and SOAP action
      request.basic_auth(username, password)
      request.add_field("SOAPAction", "")
      request.add_field("Content-Type", "text/xml;charset=UTF-8")
      # Set the envelope content obtained from the input to the request
      request.body = input
      # Execute the request and obtain the response
      response = http.request(request)
      # Parse the response to XML
      doc = Nokogiri::XML(response.body ,&:noblanks)
      s = doc.to_xml( indent:2, indent_text:" " )
      # Populate reponse content to a variable to be displayed on the output area
      params["xmlbody"] = s
      # For any other action than invokeSavon / invokeHttpRequest default the input SOAP enveloper
      params["inputpayload"] = ""+
        "<soap:Envelope xmlns:soap=\"\" xmlns:xsi=\"\" xmlns:xsd=\"\"> " + "\n"+
        "  <soap:Body> " + "\n"+
        "    <findRule xmlns=\"\"> " + "\n"+
        "      <findCriteria> " + "\n"+
        "        <fetchStart xmlns=\"\">0</fetchStart> " + "\n"+
        "        <fetchSize xmlns=\"\">-1</fetchSize> " + "\n"+
        "        <filter xmlns=\"\"> " + "\n"+
        "          <group> " + "\n"+
        "            <upperCaseCompare>false</upperCaseCompare> " + "\n"+
        "            <item> " + "\n"+
        "              <upperCaseCompare>false</upperCaseCompare> " + "\n"+
        "                <attribute>RuleId</attribute> " + "\n"+
        "                <operator>=</operator> " + "\n"+
        "                <value>300000000851162</value> " + "\n"+
        "            </item> " + "\n"+
        "          </group> " + "\n"+
        "        </filter> " + "\n"+
        "        <excludeAttribute xmlns=\"\">false</excludeAttribute> " + "\n"+
        "      </findCriteria> " + "\n"+
        "      <findControl> " + "\n"+
        "        <retrieveAllTranslations xmlns=\"\">false</retrieveAllTranslations> " + "\n"+
        "      </findControl> " + "\n"+
        "    </findRule> " + "\n"+
        "  </soap:Body> " + "\n"+
        "</soap:Envelope> " ;

The processing takes the envelope provided in input and executes the use Savon and basic "net/https" call. The content of the response is displayed to the user in the output field. To test:

  • Change to the directory where the application was created
  • Start the server with "rails server"
  • In browser navigate to "http://localhost:3000"
  • Press a button to invoke Savon / net/https call to a service, result will be updated on the output field.


In this article we covered an example using Savon and basic "net/https" for “Ruby on Rails” to integrate with Fusion Applications using web services. In future articles other technologies for invoking Fusion Applications web services 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.


« May 2016