Integrating With Fusion Application Using Services (Perl: SOAP::Lite)

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 SOAP::Lite for Perl.

Prerequisites

The reader is expected be familiar with the Perl and as such the details on creating the development environment and basic development are not covered.

Implementing Web Service Call

SOAP::Lite provides some convenience methods for the HTTP::Request approach, however it is debatable whether it provides enough benefit to warrant the usage. In many cases constructing the SOAP envelope directly would be simpler than dealing with SOAP::Lite methods:

#!/usr/bin/perl

use lib '/usr/lib/perl5/5.8.8/';

use MIME::Base64;

use SOAP::Lite;

SOAP::Lite->import(trace => debug);

# Creates new instance for the SOAP Lite

my $soap = SOAP::Lite->new(

                            proxy => 'http://host:port/hcmEmploymentCoreWorker/WorkerService',

                            service => 'http://host:port/hcmEmploymentCoreWorker/WorkerService?wsdl',

                          );

# Registers namespace(s) for the envelope

my $serializer = $soap->serializer();

$serializer->register_ns( 'http://xmlns.oracle.com/apps/hcm/employment/core/workerService/types/', 'typ' );

# Create SOAP header with security information

my $auth = SOAP::Header->new( name => "wsse:Security" );

$auth->attr( { "xmlns:wsse" => "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"});

$auth->mustUnderstand(1);

$auth->value( \SOAP::Data->value(

                  SOAP::Data->name("wsse:UsernameToken" => \SOAP::Data->value(

                      SOAP::Data->name("wsse:Username" => 'username')->type(""),

                      SOAP::Data->name("wsse:Password" => 'password')->type("")

                        ->attr( {"Type" => "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText"}),

                      SOAP::Data->name("wsse:nonce" => 'jwCzGGijT90Wml6eZe4cxg==')->type("")

                        ->attr( {"EncodingType" => "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary"}),

                      SOAP::Data->name("wsse:created" => '2012-07-04T06:49:48.981Z')->type("")

                     )->type("")

                  )->attr( {"wsu:Id" => "UsernameToken-2",

                             "xmlns:wsu" => "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"

                             })

                )->type("")

             );

# populate parameters to call the service with

my $parameters =SOAP::Data->name("typ:personId" => '300000010363707')->type("");

# call the service

my $result = $soap->call(SOAP::Data->name('typ:getWorker') => $parameters, $auth);

# Process the response, in this example we simply print out the response

die $result->faultstring if ($result->fault);

print $result->result, "\n";

The above code does the following:

  1. Creates new instance for the SOAP Lite
  2. Registers namespace(s) for the envelope
  3. Create SOAP header with security information
  4. Populates parameters to call the service with
  5. Calls the service
  6. Process the response, in this example we simply print out the response

Summary

In this article we covered an example using SOAP::Lite for Perl 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