Efficiently Integrate Enterprise Applications with Salesforce.com using Oracle SOA Suite 11g Cloud Integration Bristlecone, Inc. 488 Ellis Street, Mountain View, CA 94043 Phone: 1-650-386-4000 Fax: 1-650-961-2451 www.bcone.com
Abstract Nothing endures but change. Today s dynamic market makes it inevitable for companies to ensure the feasibility of enterprise applications to seamlessly integrate with the cloud. Oracle SOA Suite and Salesforce.com s joint clients can automate and streamline between each other, to achieve unparalleled visibility into critical sales pipeline. Moreover, it is of extreme importance for the companies to constantly enhance customer experience to sustain the competitive edge. Introduction Oracle SOA Suite 11g provides a comprehensive suite of components for developing, securing, and monitoring service-oriented architecture (SOA). It also helps enterprise applications to plug into SaaS which is a software delivery model in which software and associated data are centrally hosted on the cloud. Salesforce, on the other hand is one such SaaS application using which we would exhibit how SOA can integrate with the cloud. This white paper will exhibit how one can coalesce Salesforce.com and enterprise applications using Oracle SOA Suite 11g, the leading product in Fusion Middleware stack. The intention is to leverage Salesforce s objects by developing an integration using Oracle SOA Suite components. Problem Statement "Cloud integration is now the top concern for enterprises adopting a SaaS or cloud-based solution." Although cloud evangelists are quick to point out the benefits of cloud computing technologies, enterprise leaders have identified integration as a major obstacle to successfully adopting and deploying Software as a Service (SaaS) and other web-based applications. Challenges in cloud integration: Firewall mediation: How you're going to externalize and consume data that may not be port-80- compliant. Performance required: How fast you need to move data and how quickly the data transformation (supporting semantic mediation) and routing mechanisms need to function. Maintenance and upgrades: How you're going to support new cloud computing or enterprise systems interfaces as they evolve. Governance: How you're monitoring all points of integration and logging the data on the move. Security: How you're encrypting and otherwise protecting sensitive information, stored or on the move, cloud or on-premise. Cloud Integration using Oracle SOA Suite - Foundation for Successful Cloud SaaS Deployments Oracle SOA Suite 11g is one of the best on premise software based integration tools. It offers a solid integration strategy and plan that can support the connections and seamless transfer of data across onpremise and external services. Cloud integration is the key to realizing the full potential of your cloud investment. Without the ability to integrate your data in the cloud with your on-premise applications and databases, you create data silos and inefficiencies that can all but wipe out the benefits of
the cloud. All new enterprise architectures require the need to consolidate, collaborate and manage existing applications. Incorporating Salesforce.com Objects into Enterprise Applications At times, it becomes vital that Salesforce.com and mold Salesforce.com to conform to the business needs of the enterprise. The use cases explained in this white paper process is illustrated by Fig1 shown below: The scenarios showcased in this white paper explain how we can read a newly created OPPORTUNITY s data into an Application DB table. Whenever Order id is operations be accessible outside of its website. For instance, an OPPORTUNITY created on cloud should be available on - premise as well and any update made to the same OPPORTUNITY object via an on - premise application should be reflected on the Salesforce website. There is a need to bring into line Salesforce.com objects and enterprise applications. Integration Scenarios This whitepaper will describe how to conquer any intricacies faced while integrating with Salesforce.com Figure 1: SOA Salesforce Integration updated for a particular OPPORTUNITY in Application DB, corresponding changes are made to the same OPPORTUNITY on Salesforce.com Flow 1: Cloud to On - Premise Whenever the ReadSalesforceOpportunity BPEL process is instantiated, it picks recently created or modified Opportunities from Salesforce.com by invoking the query operation on Salesforce.com. Thereafter the records are inserted or updated into staging table on the target application.
Flow 2: On Premise to Cloud In the Application Database table, Order id is updated for records those get converted into account or sales order. It automatically, updates the Salesforce OPPORTUNITY record in Salesforce.com; 1) The order number updated now reflects on Salesforce.com for that particular OPPORTUNITY 2) The stage for OPPORTUNITY changes to Closed Won and probability is 100%. Prerequisites: The following software is required to accomplish the steps suggested in this white paper: 1. Oracle SOA Suite 11g (http://www.oracle.com/technetwork/middleware/soasui te/downloads/index.html) 2. Oracle JDeveloper (http://www.oracle.com/technetwork/developertools/jdev/downloads/jdeveloper11116-1377208.html) 3. Oracle Database (http://www.oracle.com/technetwork/products/expressedition/downloads/index.html) 4. Salesforce.com login account Integration implementation Download WSDL file form Salesforce.com Login to your Salesforce.com account (http://www.salesforce.com) by providing the appropriate credentials. Click on user profile and select setup. On the left hand pane navigate to Develop -> API A list of WSDL and client certificates is displayed. Under the Enterprise WSDL subsection click the Generate Enterprise WSDL link. A new tab opens, which give an option to generate the WSDL document. Click the Generate button. A WSDL file opens. Save this file by providing a suitable name e.g. we used SFDCEnterprise.wsdl. We would require this WSDL file later in SOA project. Entrusting Certificate authority In the WSDL file saved in the previous step an element with the name <service> exists towards the end of the file. Copy the location attributes value from it. It should be of the form https://login.salesforce.com/services/soap/c/26.0/0df9 00000000Z6O Copy this endpoint URI and open this in a new browser. Although this page will not open, giving something like an HTTP Error 405, you will be able to view the details and download the SSL certificate from here. The process of downloading SSL certificates varies for various browsers. We would display the same for Mozilla Firefox. On the same page that did not open in the previous step, click on the lock sign that appears on the left side of the address bar. A pop up window appears. Click on the More Information button on the same window. An information page comes up, click on the View Certificate button on this page. Another page with the label Certificate Viewer: login.salesforce.com opens up. On this page, move to the Details tab and select the certificate authority band and click on the Export button. The same is illustrated in the diagram below:
keytool list keystore DemoTrust.jks -storepass DemoTrustKeyStorePassPhrase Figure 2: Salesforce Certificate Detail Provide a suitable location on your system to save the certificate authority. Next step is to mark this certificate authority as trusted. Save it on a suitable location on your machine. To know the weblogic server s trust keystore location, login to admin console (http://url:port/console/). On the home page, go to Servers under Environment subsection. Select the Admin Server out of the list of servers displayed. Go to the Keystores tab. Under this tab, select the Demo Trust Keystore path. This is the path where our keystore resides It would be of the form Middleware_Home \wlserver_10.3\server\lib. Next, we need to import this certificate from the authority into our weblogic server s truststore. We are using a windows based system. Using command prompt navigate to the path mentioned in the above step. At this path run the following keytool command: keytool -import -trustcacerts -alias SalesForceCA file VeriSignClass3InternationalServerCA-G3.crt -keystore DemoTrust.jks -storepass DemoTrustKeyStorePassPhrase A message Certificate was added to keystore would come up confirming successful import of the certificate We can verify the same by enlisting all the certificates using the following command: Figure 3: List of Imported certificates in the server The last step is to restart the server to bring the modifications made in the previous steps into effect. Create a BPEL process to invoke Salesforce Login operation. We are using JDeveloper version 11.1.1.6 IDE to develop our BPEL process. Go to File -> New and select SOA Application and provide a suitable name to your application. Click Next and create a SOA project providing a suitable name to it as well. Next drag and drop a BPEL process into the components space. We kept this BPEL as a one way process (Figure 4 below) since ours is a fire and forget scenario wherein the user logs in to Salesforce and inserts the records fetched into an application database. It does not provide any output. Another component that would be brought into the composite is a Web Service Adapter. Create it on the basis of WSDL downloaded in Step 1 of this demonstration.
Figure 4: BPEL Configuration On the composite.xml, provide wiring between both the components, i.e. the SFDCReference web service adapter and ReadOpportunityProcess.bpel process. Next, we move to designing the logic within our BPEL process. In Salesforce the first operation that is invoked is the login operation. This process takes 2 inputs: user name and password via payload. The password is a combination of Salesforce password and the security token. Only when we are successfully able to invoke the login operation we would be able to invoke the other operations on Salesforce. An assign activity assigning values to username and password parameters should be placed prior to the Invoke activity that calls Salesforce s login operation. The output payload provides two important details using which we would precede with the subsequent operations. These are as follows: o ServerURL: This is the URL that needs to be called for all subsequent operations (query, update etc.) for this user. o Session ID: This ID needs to be sent as part of header information for all operations post login Configuration for Server URL: Create one variable in BPEL project of EndpointReference type importing the WS Addressing namespace in your.bpel file. xmlns:wsa=http://schemas.xmlsoap.org/ws/20 03/03/addressing <variable name="partnerreference" element="wsa:endpointreference"/> Create an assign activity to map ServerURL into this variable, by first copying the URL into partnerreference/wsa:endpointreference/wsa:add ress XPATH and then subsequently assigning this variable directly to the partner link prior to invoking the second operation Configuration for Session Id: Create a variable of message type urn:enterprise.soap.sforce.com: Header Figure 5: Header Variable to hold session id Map the session id retrieved from the login operation into this variable. While invoking the partner link in the headers tab select this variable. Figure 6: Header Tab contains Header Variable Next, we move to individual use cases.
Flow 1: As stated earlier, in the cloud to on premise flow we would read the recently created opportunity on Salesforce.com Create a BPEL that would follow all steps that are common to both use cases. Insert an Invoke activity that would invoke the query operation of Salesforce to read records from Salesforce. In the input to the invoke activity we need to provide a query that would fetch records from Salesforce s OPPORTUNITY object. The invoke activity s output variable would contain records fetched from OPPORTUNITY object. Map the response of query operation with input payload of database adapter. Figure 8: Query to DB Transformation Salesforce WSDL exhibits polymorphic behavior. Records need to be substituted as actual Salesforce object Opportunity as shown below- Figure 7: Invoke Activity The query is of the form: SELECT Amount,CloseDate,Description,Id,Name,StageName,Typ e, OrderNumber c FROM OPPORTUNITY WHERE LastHourOpport c=1 This query we would assign to the queryrequestvariable above. Figure 9: Substitution Dialogue Box Lastly, we use a Database adapter to insert/update the records in the target application s staging tables. For this, we select the merge operation of database adapter. Deploy this BPEL on the SOA server and test the same. The complete BPEL process flow looks as the one in Figure 10.
Update OPPORTUNITY Use Case Figure 10: Complete BPEL Process for Flow1 We have created a staging table named OPPORTUNITY in our target application that has a structure similar to Salesforce.com OPPORTUNITY object s important attributes. Whenever any update happens in this database table. The changes are propagated via a BPEL process to the Salesforce.com site. After following the procedure up to Step3, create a Database adapter in the same composite.xml. Provide a suitable name to your adapter. In the operations section, select Poll for new or changed record in a table. Next select the Logical Delete option on the After Read page of Database adapter. Accordingly, we configure the database adapter such that whenever any changes occur in this table, they are read and a new BPEL instance is created whose input is the set of updated records. Figure 11: DB Adapter Configuration After the login operation is performed, we invoke the Salesforce webservice for Update operation. In the Invoke activity we select operation as update Prior to this step add a Transform Activity that would map the records fetched from the OPPORTUNITY
table of the application DB to the Invoke activity s input. On the target side of this transform activity, you would observe Salesforce WSDL s polymorphic behavior once again. In the Substitute Element or Type Dialog Box, select Salesforce s OPPORTUNITY object. Figure 12: DB to Update Transformation Figure 13: Complete BPEL Process for Flow2 As per the scenario, as soon as OPPORTUNITY gets converted into an ACCOUNT / SALES ORDER, OMS system generates order id corresponding to that OPPORTUNITY and that OPPPORTUNITY is considered as Closed Won. In the transform activity if Order id is present for an OPPORTUNITY, its stage changes to Closed Won, else it is kept same as in target application. Next deploy the BPEL and test the same by updating target application s staging tables. If the changes are evident on Salesforce.com site, then your BPEL is ideal. The complete BPEL process for update opportunity use case looks as the one in Figure 12.
This way we created two integrations between SOA and Salesforce. One that would fetch data from Salesforce and other that would update data into Salesforce. Conclusion Integrating Oracle SOA Suite and Salesforce.com would help resolve an organization s CRM requirements. The steps to implement the same can be summarized as follows: 1) Download Enterprise WSDL from Salesforce.com 2) Download Entrusted certificate from Salesforce.com and import the same to your server using keytool utility 3) Create a BPEL that would invoke the login operation. 4) From the output of this operation, capture the Session Id and Server URL that would serve as input to subsequent operations. 5) Invoke other Salesforce operations as per your usage. References [1]http://www.youtube.com/watch?v=gLCbfgaKhs&hd=1 - Cloud Integration Episode 2_ Connecting with Oracle RightNow [3]https://blogs.oracle.com/SOA/entry/cloud_integratio n_white_paper_now [2]http://www.oracle.com/us/solutions/cloud/cloudintegration-wp-1873149.pdf [4]http://www.oracle.com/us/solutions/cloud/cloudintegration/overview/index.html [5]http://www.oracle.com/technetwork/middleware/so asuite/learnmore/advancedsoawp-1652219.html About Bristlecone Bristlecone is a leader in advising clients on how to maximize the strategic value of their supply chains and assisting them in unleashing that value rapidly through effective use of enabling technologies. With our singular focus on addressing procurement and supply chain challenges, we help our clients to diagnose, design, enable and enhance their operations by encapsulating our years of experience into pre-configured solutions, accelerated deployments and enhancement packs for the leading supply chain technologies. Partner with Bristlecone to optimize your supply chain investment and implement quick time-to-value solutions. To set up a discussion with our team, please send your inquiry to sales@bcone.com