R12.1 - Invoking Web Service from OA Framework Pages

Introduction

Invoking a web service from within E-Business Suite has always been a open topic (A BPEL process's entry point itself is a web service so initiating a BPEL process is nothing but invoking the web service endpoint). There were different mechanisms used in different implementations from 11i to R12 and there are some nice articles on internet from E-Business Suite experts. Some of the methods used are

  1. Generate Axis client code and call from within OA Framework controller
  2. Use Business Event through EBS Adapter to trigger a BPEL Process on middle tier
However, invoking a web service dynamically without writing a single line of code specific to web service invocation is sure to save a lot of time and effort. We already discussed about R12.1 feature Service Invocation Framework (SIF) in one of the earlier posts on this blog Invoking Web Service from Oracle Workflow.

Synchronous or Asynchronous


SIF setup is already covered in the aforementioned blog post. A web service may be invoked using SIF either synchronously or asynchronously based on the SIF setup. The synchronous or asynchronous invocation of the web service using SIF should not be confused with the request pattern supported by the target web service being invoked.

Synchronous or Asynchronous invocation with SIF

Whether you want to invoke a web service synchronously or asynchronously using SIF in respect to your code depends on whether your "Invoke Web Service" event subscription has phase < 100 or >= 100.

If the event subscription has phase < 100, and the event is raised from Java code (for example OA Framework page controller) then the web service is invoked synchronously and the response is available immediately to the calling code. If the event subscription has phase >= 100 and the event is raised from Java code (for example OA Framework page controller) then the web service invocation is deferred to WF_JAVA_DEFERRED queue and is executed by Workflow Java Deferred Agent Listener. In order to capture the response from the web service it is required to define a callback business event and subscription.

More information on how an business event subscription is executed for different phases is explained in the blog post PLSQL vs Java Business Event System.

Synchronous or Asynchronous request pattern of target web service

If the web service itself is defined to be synchronous or asynchronous is determined based on the WSDL operation definition. This means whether the response from the web service is available immediately or at a later time after the initial request was sent to the service. Some of the prominent industry standards for asynchronous web service patterns are WS-Addressing and WS-Polling. At this point SIF does not have out-of-the-box support for invoking web services that return response asynchronously.

Invoking Web Service from OA Framework


Invoking a web service from OA Framework is nothing but raising a business event using Java API oracle.apps.fnd.wf.BusinessEvent.raise(). Only difference with web service invocation is that after the event raise API, you could call String respData = (String)event.getResponseData();.

Following sample could be used in AMImpl.java for invocation.
    
     // invoker business event
     String eventName = "oracle.apps.prod.xxxx.invoke.service";
     // unique key for the web service invocation
     String eventKey = "key1";
     // event data - XML payload sent to web service as input
     // String evtData = ....
     Connection conn = ((OADBTransactionImpl)getOADBTransaction()).getJdbcConnection();
     BusinessEvent event = null;
     try{
         event = new BusinessEvent(eventName, eventKey);
         event.setData(evtData);
         event.raise(conn);
     }
     catch (BusinessEventException e) {
         throw new OAException("Exception occured when invoking web service - "+e.getMessage());
     } finally {
        getOADBTransaction().commit();
     }
     String respData = (String)event.getResponseData();
     return respData;

Extending SIF

Service Invocation Framework internally uses a Java subscription rule function oracle.apps.fnd.wf.bes.WebServiceInvokerSubscription
that implements interface oracle.apps.fnd.wf.bes.SubscriptionInterface. Like any Java rule function the entry point from Business Event System to the rule function is onBusinessEvent method. In order to perform Custom processing during web service invocation, you could write your own Java rule function by
implementing SubscriptionInterface and extending WebServiceInvokeSubscription class to override the required methods. The custom rule function can then be used in place of oracle.apps.fnd.wf.bes.WebServiceInvokerSubscription while consuming the web service in the Invoke Web Service subscription wizard.

public class MyWebServiceInvoker
    extends WebServiceInvokerSubscription
    implements SubscriptionInterface
{
}
Click Here view a sample sub-class that extends SIF's default processing.

Extensible Methods

  1. preInvokeService
  2. postInvokeService
  3. invokeService
  4. addWSSecurityHeader
  5. setInputParts
For more information on these extensible methods please refer to Integrated SOA Gateway Developer's Guide.

Rule function substitution

Once the Custom rule function is developed to extend SIF's processing, the class should be used at the time of "Invoke Web Service" subscription definition as follows.

sif_2.png


Comments:

Hi, Is this feature available even for Release 11i?

Posted by Ajay on June 24, 2010 at 01:57 PM IST #

Hello Ajay, No, this feature is not available in Oracle E-Business Suite 11i. This is available only from Oracle E-Business Suite 12.1.1 onwards. Thanks Vijay

Posted by vijayakumar.shanmugam on June 24, 2010 at 03:23 PM IST #

Hi,
We are using Oracle apps version 12.0.6 and we have requirement where we need to invoke a bpel process from OAF form. Can you please let us know how to do this?

Regards
H

Posted by Himanshu on September 19, 2011 at 07:44 AM IST #

Hi,

How can it be done from 11i?
And also, how can I use the same authentication I have in the EBS with SOA suite applications (like workspace etc...)?

Thanks
Joe

Posted by guest on July 21, 2013 at 02:25 PM IST #

Post a Comment:
  • HTML Syntax: NOT allowed
About

Straight from Oracle EBS Integrated SOA Gateway and EBS Adapter Development Team.

Search

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