Monday, 23 July 2012

Exception driven BPEL Salesforce Authentication




Salesforce Authentication with Oracle SOA ("Exception-driven Authentication")


In this Blog , I will be sharing a different approach we followed in EAI (BPEL) to invoke the Salesforce Services. The requirement was to invoke Salesforce REST API which uses 

OAuth 2.0 (by passing a session ID in the HTTP Authorization Header) for Authorization.It was confirmed that the Salesforce Login Session Id would remain active for 8 hours.
Hence BPEL need not  to perform the SFDC Login call for every incoming request.[Guessed it right!! we need Cache it internally]




The approach was - 

"Exception driven Authentication " where in,Salesforce login flow would be only triggered in case of INVALID SESSION exception, while making call to salesforce REST API


The Login Scope ensure that once the 

SFDC Login  retrieves a new session Id, it replays the Salesforce REST API flow, but this time using  the new session Id,expecting the same to work this time.



for the fact that salesforce session id would remain active for next 8 hours, We also cache the sessionid in in the Xref table.,so that  a regular look-up and reuse of the session can be done for all subsequent request that follows.










SF Login + Caching done in case of  Invalid-session


I chose to use Xref tables because,
felt that this was right place to dynamically update and retrieve the  session-Id as per demand.



[.....but again,you might follow a different approach to store the same as in a global Variable or property file..but never in a DVM- definitely this is not meant to store any dynamic/configuration data :) ]