salesforce.com integration using sap pi%3a a case study

Upload: chandra-ch

Post on 18-Oct-2015

110 views

Category:

Documents


0 download

DESCRIPTION

Salesforce.com Integration Using SAP PI%3a a Case Study

TRANSCRIPT

  • SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com

    2010 SAP AG 1

    Salesforce.com Integration Using

    SAP PI: A Case Study

    Applies to:

    SAP NetWeaver Process Integration 7.1.

    For more information, visit the Service Bus-based Integration homepage.

    Summary

    This article explains step by step procedure to integrate SAP PI with Salesforce.com (SFDC) using the enterprise WSDL.

    Author: Prasanna Vittal

    Company: Wipro Technologies

    Created on: 23 June 2010

    Author Bio

    Prasanna Vittal is currently working for Wipro Technologies as an SAP XI/PI Consultant. He has over 3.5 years of experience in SAP Integration Technologies viz. SAP XI/PI and SAP MII.

  • Salesforce.com Integration Using SAP PI: A Case Study

    SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com

    2010 SAP AG 2

    Table of Contents

    Introduction ......................................................................................................................................................... 3

    Overview ............................................................................................................................................................. 3

    Step by Step Execution ...................................................................................................................................... 4

    Create developer account in SFDC ................................................................................................................ 4

    Download the Enterprise WSDL ..................................................................................................................... 4

    Testing the WSDL using SOAPUI ................................................................................................................... 4

    Implementation Using SAP PI 7.1 ................................................................................................................... 6 Design Steps ................................................................................................................................................................ 6

    Configuration Steps ................................................................................................................................................... 12

    Testing the Interface .................................................................................................................................................. 16

    Related Content ................................................................................................................................................ 17

    Disclaimer and Liability Notice .......................................................................................................................... 18

  • Salesforce.com Integration Using SAP PI: A Case Study

    SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com

    2010 SAP AG 3

    Introduction

    In our current project, the client has decided to replace SAP CRM with Salesforce.com (SFDC Online CRM). We are doing a POC to integrate SFDC with SAP ECC using SAP XI.

    I would like to thank Bhavesh Kantilal, Saravana Kuppusamy, Harsh, Santhosh, Unnamalai and Pragya for helping me out during the implementation of this Proof of Concept.

    Overview

    Salesforce.com (SFDC) is a Software as a Service (SaaS) company that distributes business software on a subscription basis. It is best known for its Customer Relationship management (CRM) products. This article explains various steps involved in the integration of SFDC with SAP ECC using SAP PI 7.1. SFDC exposes a web services interface that can be accessed using an Enterprise WSDL. Some of the web services are Create Account, Update/Upsert/Delete Account, Query Account Details etc.,

    In the article, I will show how to call a simple SFDC web service - getServerTimestamp, which when called, gives the server timestamp as response. Once we achieve this, we can implement any of the web service that SFDC offers, with some modifications to the WSDL file.

  • Salesforce.com Integration Using SAP PI: A Case Study

    SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com

    2010 SAP AG 4

    Step by Step Execution

    Create developer account in SFDC

    Register yourself at http://developer.force.com. You will get the username and password by email. You need to login to SFDC and get the security token, which should be appended with the password, while calling the login web service of SFDC. To get this, login to http://developer.force.com and then go to Setup->Personal Setup->My Personal Information->Reset My Security Token. You will receive the security token by email.

    Download the Enterprise WSDL

    Login to http://developer.force.com and go to Setup->App Setup->Develop->API. Under Enterprise WSDL, click on Generate Enterprise WSDL and save it as a .wsdl file on your local machine.

    Testing the WSDL using SOAPUI

    We did this optional step to see the WSDL structure and to test the various web services exposed in the Enterprise WSDL. Below steps will help you understand what we did.

    a. To implement any business scenario(e.g. Create an Account in SFDC database, query Account details from SFDC or to Update Account details in SFDC, etc) using the WSDL approach, SFDC will want you to call the corresponding web service(query, Create, Update, Upsert etc).

    b. But, to call these web services, we will need an additional sessionId/serverUrl attributes to be set in the SOAP Header of the web service request. To get this, we have to first call the login web service, which returns the sessionId & the serverUrl. To call the login web service, we will need the username/ (password+security token) (got during the registration process).

    Below is the screenshot of the login web service request.

  • Salesforce.com Integration Using SAP PI: A Case Study

    SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com

    2010 SAP AG 5

    Once we receive the Session ID and Server URL, we have to set them in the header of getServerTimestamp web service and get the Servers timestamp as response. Below is the screenshot for the same.

  • Salesforce.com Integration Using SAP PI: A Case Study

    SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com

    2010 SAP AG 6

    Implementation Using SAP PI 7.1

    Now, we will implement the same using SAP PI 7.1.

    Design Steps

    Below are the design steps that we need to perform in the Enterprise Service Repository:

    Create the namespace and import the Enterprise WSDL as an external definition.

  • Salesforce.com Integration Using SAP PI: A Case Study

    SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com

    2010 SAP AG 7

    Create an Outbound Synchronous Service Interface. Assign the External Definitions loginRequest as the Output message.

  • Salesforce.com Integration Using SAP PI: A Case Study

    SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com

    2010 SAP AG 8

    Similarly, assign getServerTimestampResponse from the external definition, as the input message.

    Create an Inbound Synchronous Service Interface. Assign the External Definitions getServerTimestampRequest as the Output message and getServerTimestampResponse as the input message, as shown in the above screenshot.

  • Salesforce.com Integration Using SAP PI: A Case Study

    SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com

    2010 SAP AG 9

    Create a message mapping. Load the loginRequest at the Source side and getServerTimestampRequest at the target side.

  • Salesforce.com Integration Using SAP PI: A Case Study

    SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com

    2010 SAP AG 10

    Create a UDF (SampleUDF1) and use Dynamic Configuration to set the parameter TServerLocation with the Server URL that we received in the response message of the login web service. We found out that this Server URL is always constant, so we have manually set this in the UDF. We can assign this UDF to any node in the target.

    We will create a Java Mapping Program to obtain session ID and server URL by doing a SOAP lookup, and set these fields in the SOAP Envelope. Create a new Java Mapping Class using SAP NetWeaver Developer Studio. We will use the DOM parser to parse the SOAP response. In the execute() method, we will call two functions. In the first one, we will pass the username and password (password+security token, without +) to the SOAP lookup API to login to the SFDC and get the Session ID. For details regarding SOAP Lookup, refer to Bhaveshs Blog in the Related Articles section.

    In the second function, we will add the SOAP Envelope to the incoming payload and set the sessionId field in the SOAP Header. For the complete Code, refer to uarunas wiki page. You can also find this link under Related Contents section, at the end of this article.

    Export the Java Class as a .JAR file and import it into the ESR under Imported Archives.

  • Salesforce.com Integration Using SAP PI: A Case Study

    SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com

    2010 SAP AG 11

    Create an Operation Mapping and use the Message mapping and Java mapping in sequence.

  • Salesforce.com Integration Using SAP PI: A Case Study

    SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com

    2010 SAP AG 12

    Configuration Steps

    Below are the configuration steps that we need to perform in the Integration Directory:

    Create Business Components for the Sender ECC system and SFDC Receiver.

    Create a Receiver SOAP Communication Channel (Channel1). Since this channel will be used in the SOAP lookup, it should not be associated with any Receiver Agreement. In this channel, we provide the Target URL (https://www.salesforce.com/services/Soap/c/18.0) and SOAP Action (login).

  • Salesforce.com Integration Using SAP PI: A Case Study

    SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com

    2010 SAP AG 13

    Create another Receiver SOAP Communication Channel (Channel2). Settings will be as follows:

    o Provide Target URL (it will be over written by the Dynamic Configuration).

    o Check Use Adapter-Specific Message Attributes and Variable Transport Binding, since we are setting the TServerLocation attribute using Dynamic Configuration within the UDF.

  • Salesforce.com Integration Using SAP PI: A Case Study

    SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com

    2010 SAP AG 14

    o Under Conversion Parameters, check Do Not Use SOAP Envelope, as we are manually building the SOAP Envelope, to set the fields in the SOAP Header.

    o Provide the SOAP Action (getServerTimestamp).

  • Salesforce.com Integration Using SAP PI: A Case Study

    SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com

    2010 SAP AG 15

    o Since we are using the SOAP Adapter with option Do Not Use SOAP Envelope, the content type of the incoming message will be application/xml. We need to change it to text/xml. To achieve this, we need to use the adapter module MessageTransformBean before the XISOAPAdapterBean and set the parameter Transform.ContentType to text/xml.

    Create Receiver Determination and Interface Determination with ECC System as the sender and Business Component for SFDC as the receiver. In the Interface Determination, use the Operation Mapping and Inbound Interface that we created in ESR.

    Create a Receiver Agreement and provide the Communication Channel (Channel2).

  • Salesforce.com Integration Using SAP PI: A Case Study

    SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com

    2010 SAP AG 16

    Testing the Interface

    Steps to be followed for testing this interface are as follows:

    1. We can trigger this interface from the sender ECC system in two ways.

    a. ABAP Proxy

    b. RFC Call.

    (For testing purpose, we can even use Runtime Workbenchs test tool or an HTTP Client)

    2. We dont have to pass any values in the source message, as we are directly passing the credentials in the java Mapping. Below is a screenshot of RWBs test tool.

    3. The screenshot of the request message is below:

  • Salesforce.com Integration Using SAP PI: A Case Study

    SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com

    2010 SAP AG 17

    4. After the SOAP lookup, this is how the message looks like:

    5. Screenshot of the response message

    Related Content

    1) Java Mapping Program Wiki by uaruna

    http://wiki.sdn.sap.com/wiki/display/XI/SFDC+Integration+using+PI+7.1+-+How+to+add+SOAP+Envelope+in+Java+Mapping

    2) SOAP Lookup Bhaveshs Blog

    http://www.sdn.sap.com/irj/scn/weblogs?blog=/pub/wlg/5001

  • Salesforce.com Integration Using SAP PI: A Case Study

    SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com

    2010 SAP AG 18

    Disclaimer and Liability Notice

    This document may discuss sample coding or other information that does not include SAP official interfaces and therefore is not supported by SAP. Changes made based on this information are not supported and can be overwritten during an upgrade.

    SAP will not be held liable for any damages caused by using or misusing the information, code or methods suggested in this document, and anyone using these methods does so at his/her own risk.

    SAP offers no guarantees and assumes no responsibility or liability of any type with respect to the content of this technical article or code sample, including any liability resulting from incompatibility between the content within this document and the materials and services offered by SAP. You agree that you will not hold, or seek to hold, SAP responsible or liable with respect to the content of this document.