Integrating With Fusion Application Using Services (PHP)

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

Prerequisites

The reader is expected be familiar with the PHP and as such the details on creating the development environment and basic development are not covered. On high level to create development environment on Windows you would follow these steps:

  • Download and install EasyPhp
  • Enable Soap extension by removing comment character (";") from the beginning the line with "extension=php_soap.dll" in php.ini
  • Enable SSL extension by removing comment character (";") from the beginning the line with "extension=php_openssl.dll" in php.ini

Implementing Web Service Call

We can create a simple form to call the SoapClient as follows:

<?php

// Process POST requests

if ($_SERVER['REQUEST_METHOD'] == 'POST'){

  try {

    $username ="username";

    $password ="password";

    // Create new instance for the client

    $client = new SoapClient("https://host:port/icCnSetupCreditRulesPublicService/CreditRuleService?wsdl",

                              array('trace' => 1,

                                    'login' => $username,

                                    'password' => $password));

    // Construct the payload to be used to invoke the service.

    $params = array(

      'findCriteria' => array(

        'fetchStart' => '0',

        'fetchSize' => '-1',

        'filter' => array(

          'group' => array(

            'upperCaseCompare' => 'false',

            'item' => array(

              'upperCaseCompare' => 'false',

             'attribute' => 'RuleId',

              'operator' => '=',

              'value' => '300000000851162')

          )

        ),

        'excludeAttribute' => 'false'

      ),

      'findControl' => array(

        'retrieveAllTranslations' => 'false')

    );

    // Invoke the service

    $response = $client->FindRule($params);

    // Process the response, in this example we simply copy the content to a variable displayed as output

    $dom = new DOMDocument;

    $dom->preserveWhiteSpace = FALSE;

    $dom->loadXML($client->__getLastResponse());

    $dom->formatOutput = TRUE;

    $dom->saveXml();

    $output = $dom->saveXml();

  } catch(Exception $e) {

    print "Exception: " . $e->getMessage();

  }

} else {

  // For GET request set the variable displayed as output

  $output = "";

}

?>

<form name="envelope" method="POST">

  <!-- Button used to start the processing -->

  <input id="invoke_service" type="submit" value="Invoke Service" />

  <!-- Text area to display the result for processing. As the result is XML it is encoded as otherwise it would not be displayed correctly  -->

  <textarea name="outputpayload" wrap="off" style="width:100%;height:100%" rows=30><?php echo htmlentities($output);?></textarea>

</form>

The above code does the following:

  • There is a simple HTML form that contains a button to submit a request and a text area to display the results.
  • The processing logic will branch on the type of request; for POST a web service is called and for any other request the value of the text area containing the result is emptied.
  • The processing logic creates a new instance for SoapClient
  • Array structure is constructed to contain the parameters passed to the service
  • The response is parsed as XML and assigned to a variable that is displayed in the text area for output

Summary

In this article we covered an example using SoapClient for PHP to integrate with Fusion Applications using web services. In future articles other technologies for invoking Fusion Applications web services will be covered.

References




Comments:

Post a Comment:
  • HTML Syntax: NOT allowed
About

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.

Search

Categories
Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
4
5
6
8
11
12
13
15
16
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today