SAP PI SALESFORCE BULK API
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
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:
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.
UDF Snippets: (Assign session id and content type to the headers)
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
Use Variable transport binding for dynamic session and content type in http headers which we assigned in UDF (XHeaderName1 & XHeaderName2).
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:
Use UDF to assign jobid to export parameter for CCBPM.
Create Export parameter in mapping.
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:
CCBPM: Import Parameter:
UDF Snippets: (Assign session id, content type and http url to the headers)
Communication Channel:
Channel to send Job.xml to salesforce:
Http url – TServerLocation
Http headers – X-SFDC-Session and Content-Type
Use Variable transport binding for dynamic URL, session and content type in http headers which we assigned in UDF (XHeaderName1, XHeaderName2 & XHeaderName3).
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.
CCBPM: Import Parameter
UDF Snippets: (Assign session id, content type and http url to the headers)
Communication Channel:
Channel to send Job.xml to salesforce:
Http url – TServerLocation
Http headers – X-SFDC-Session and Content-Type
Use Variable transport binding for dynamic URL, session and content type in http headers which we assigned in UDF for (XHeaderName1, XHeaderName2 & XHeaderName3).
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.
Good Job! Any ideas on how to imeplement this on single stack PI Java only.
Hi Rajeev,
I believe using Netweaver BPM you can implement this in single stack. Check below link
might help you.
http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/90308598-4b8d-2f10-4a9a-b78973859665?QuickLink=index&…
Regards,
Praveen
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
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.
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
I would like to see the next blog where you explain step by step this procedure to use bulk API in SAP PO