Skip to Content

In this blog I’m going to give an idea how we can achieve bulk API using SOAP adapter and CCBPM in PI. Salesforce supports three API’s for data integration. 1. SOAP API (Synchronous) – It support only 200 records for any operations like insert/update and delete. 2. REST API (Synchronous) – It also support only 200 records for any operations 3. BULK API (Asynchronous) – It support 10,000 records per message. SOAP API already well explained in this link by Prasanna, I tried BULK API by using SOAP adapter with CCBPM in PI.


BULK API

It is useful when you are trying to bulk insert, update and upsert in salesforce. If your interface performs below three operations for salesforce then it perform the BULK API.

1. Create Job

2. Add Job

3. Close Job


Logical Flow:
logical diagram.PNG


Please check the link for more information https://www.salesforce.com/us/developer/docs/api_asynch/index_Left.htm#CSHID=asynch_api_quickstart_requests_intro.htm|StartTopic=Content%2Fasynch_api_quickstart_requests_intro.htm|SkinName=webhelp for bulk API. Sample example provided in link to load data using CURL, here I tried to compare the CURL example with my development in PI.


To Perform above steps we need BPM to achieve. Here i used CCBPM to follow the steps in single interface.


CCBPM for Bulk API:

CCBPM for Salesforce.png


Step1 – Salesforce Login:

For this we can use SOAP Lookup in message mapping to login into salesforce to get the SessionId and ServerURL. Please check link http://scn.sap.com/community/pi-and-soa-middleware/blog/2006/11/20/webservice-calls-from-a-user-defined-function for SOAP Lookup.


Step2 – Create Job:

Before you send the data to perform some operation in saleforce, you need to prepare the job by providing which operation you are going to perform for object. For that you need to prepare Job xml to request to salesforce. Once you request salesforce, it will prepare the job and provide you the response message with jobid, by using this job id you can send bulk data to perform operation in slaesforce.


Create request mapping for preparing Job.xml with soap lookup UDF to get session id and assign it dynamically in http headers for the soap adapter.

createjob request.png

UDF Snippets: (Assign session id and content type to the headers)

createjob udf.png

Communication Channel:

Channel to send Job.xml to salesforce:

Http url – https://instance.salesforce.com/services/async/30.0/job

Http headers – X-SFDC-Session and Content-Type

cc createjob.png

Use Variable transport binding for dynamic session and content type in http headers which we assigned in UDF (XHeaderName1 & XHeaderName2).

cc createjob headers.png

The response of this message will contain Jobid, assign this id to BPM by using export parameterized mapping for the response message.

Response message mapping:

createjob response.png

Use UDF to assign jobid to export parameter for CCBPM.

createjob response udf.png

Create Export parameter in mapping.

createjob export.png


Step 3 – Add Job:

Once you completed the step 2 (create job) in PI, you will have the jobid in CCBPM to send data to perform bulk operation in salesforce. You need to prepare the add job url by appending url with jobid/batch.  Here we can send XML data to perform operation in salesforce object.

Create Request mapping:

Add job request.png

     CCBPM:                                                                          Import Parameter:

Add job bpm.png

UDF Snippets: (Assign session id, content type and http url to the headers)

Add job udf.png

Communication Channel:

Channel to send Job.xml to salesforce:

Http url – TServerLocation

Http headers – X-SFDC-Session and Content-Type

cc addjob.png

Use Variable transport binding for dynamic URL, session and content type in http headers which we assigned in UDF (XHeaderName1, XHeaderName2 & XHeaderName3).

cc addjob headers.png

Step 4 – Close Job:

Once above steps completed we can close the job using the same jobid. Here we need to pass the xml data with status closed to salesforce using the url with job id to close the job.

/wp-content/uploads/2014/07/closejob_496668.png

     CCBPM:                                                                                     Import Parameter

closejob bpm.png

closejob map.png

UDF Snippets: (Assign session id, content type and http url to the headers)

closejob udf.png

Communication Channel:

Channel to send Job.xml to salesforce:

Http url – TServerLocation

Http headers – X-SFDC-Session and Content-Type

cc closejob.png

Use Variable transport binding for dynamic URL, session and content type in http headers which we assigned in UDF for (XHeaderName1, XHeaderName2 & XHeaderName3).

cc closejob headers.png

This blog is to just giving idea that Salesforce bulk API is possible in PI by using SOAP adapter, Parameterized mapping, BPM and variable transport binding. In Next blog I will try to cover step by step procedure to use bulk API in PI.

This is my first blog, Please share your thoughts/feedback and your solution to achieve Salesforce BULK API.

To report this post you need to login first.

5 Comments

You must be Logged on to comment or reply to a post.

      1. Pradeep A

        Hi Praveen,

        i am doing SFDC integration

        Scenario: Outbound (Sync), Proxy (ABAP)—PI–SOAP

        SAP PI 7.3 (Single Stack)

        1) for sesssion ID i am using Java mapping is it correct.

        2) for response also using XML mapping.

        can you explain i am going correct way?

        Regards

        Pradeep

        (0) 
  1. venkatesh chinni

    Hi All,

    I tried using your blog, I am sending the Session ID to the Job Channel in the HeaderName1 using Dynamic configuration, Can i know what is X-SFDC-Session in the Variable XHeaderName1 in the create job step.
    Where i am getting an error while getting the Job ID as response from Sales force.
    Can any one help me in resolving the issue.

    (0) 
  2. Sai D

    Hi Praveen,

     

    Thanks to your blog, I got some Idea on how we need to integrate salesforce.

    I have the same requirement to Integrate the Sales Force using BULK API . But since we are using NW 7.4 Single stack tried to create a NW BPM for the above requirement

    I have followed the NW BPM: http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/90308598-4b8d-2f10-4a9a-b78973859665?QuickLink=index&… but not able to succeed in doing it.

    Please let me know how to create a job , Add a job and Close Job in NW BPM?

     

    Thanks

    Sai

    (0) 

Leave a Reply