ABAP Studio

SOAP SAP ECC to Salesforce Integration using SOAP

By Nishant Chavan

I have recently done SAP ECC to Salesforce integration using SOAP adapter, there are few blogs already available but I could not find the step by step blog. This might help if someone is doing this integration for the first time.

SAP to Salesforce integration is 2 steps process.

Get session ID using login request (Salesforce generate new session id every few hours, this can be configurable)
Actual post/update request using session id retrieved from the first step

Get Salesforce WSDL: Request the salesforce WSDL from salesforce team or download it, here are the steps to download if you have access to Salesforce server
Log in to your Salesforce developer organization in your browser.
From Setup, enter API in the Quick Find box, then select API.
Download the appropriate WSDL files for the API you want to use.
Create SOAP project: Create new soap project using to Salesforce WSDL, you will see all the operations on the left side. use the login operation to see if you can log in with the username and password. Please note the password is “password + Security Token”
Create WSDL/XSD: We cannot directly use the Salesforce WSDL if we are using graphical mapping because it does not give the structure. I have created this with below steps.
Created successful/working upsert request using SOAPui
Created XSD for that request using external tools (jedit/XMLSpy) or tools available on the internet.
Create ESR objects (ED, MT, SI, MM, OM): Import external definition created in the earlier step, create other ESR objects. Here are the objects which you need if your scenario is Async to Sync:Some points while creating ESR objects:
All service interface should be of category outbound
While creating Operational Mapping, the inbound SI should be Async and Outbound should be Sync but OM will not get activated. The workaround is to create outbound as Async until you activate OM and then change it to Sync
Message Mapping: Mapping tips to map more than 1 sObjects: I am updating 2 sObects using one mapping. I am doing this because the first sObject is custom and it has to be updated before I update the contact sObject. I have handled this in the mapping conditions. Here is the example of SOAP request.
API lookup code to get sessionid and server URL: Here is the code, this is also available on multiple blogs
String sessionId = “”;
String url=””;
try {

Channel channel = LookupService.getChannel(“SF”, “BC_SF”, channelname);
SystemAccessor accessor = null;
accessor = LookupService.getSystemAccessor(channel);
String loginxml = “<login xmlns=\”urn:enterprise.soap.sforce.com\”><username>” +
username +
“</username><password>” +
password +
InputStream inputStream = new ByteArrayInputStream(loginxml.getBytes());
Payload payload = LookupService.getXmlPayload(inputStream);
Payload soapOutPayload = null;
soapOutPayload = accessor.call(payload);
getTrace().addDebugMessage(“Returned: ” + soapOutPayload.toString());
InputStream inp = soapOutPayload.getContent();
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
DocumentBuilder builder = factory.newDocumentBuilder();
Document document = builder.parse(inp);
NodeList sessionId1 = document.getElementsByTagName(“sessionId”);
Node node = sessionId1.item(0);

if (node != null) {
node = node.getFirstChild();
if (node != null) {
sessionId = node.getNodeValue();

//Code to set Dynamic url
NodeList urlnodelist = document.getElementsByTagName(“serverUrl”);
Node urlnode = urlnodelist.item(0);

if (urlnode != null) {
urlnode = urlnode.getFirstChild();
if (urlnode != null) {
url = urlnode.getNodeValue();
//Get the dynamic configuration from the container
DynamicConfiguration conf = (DynamicConfiguration) container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
//Create the TServerLocation key in namespace http://sap.com/xi/XI/System/SOAP. This key will hold the dynamically created URL
DynamicConfigurationKey key = DynamicConfigurationKey.create(“http://sap.com/xi/XI/System/SOAP”, “TServerLocation”);

//Put the url value from the input in the configuration under the specified key
conf.put(key, url);
} catch (Exception e) {

return sessionId;
Communication channel for lookup:

ID configuration: Create 2 ICO’s first to get data from ECC and send it to Salesforce. I am showing only communication channel screen shot. This has dynamic configuration and module configuration for Async and Sync bridge.Module Config for Async-Sync Bridge
Issues: I had below issues during this integration.

1. WSDL: Salesforce uses inherent WSDL which we cannot directly use in PI ESR if you are doing the graphical mapping. We need to create the request using SOAPui and need to

2.REST PATCH Method support: We need to insert/update the records. We tried to use POST method however it did not work. This is possible only using PATCH method which is not available in SAP’s REST adapter. We have used SOAP instead of REST. 3.TLS1.1 + Requirement: Salesforce disabling TLS1.0 on July 22, 2017. All application connecting to Salesforce should support TLS1.1 and above. We had to upgrade our PI server to support this.

3.TLS1.1 + Requirement: Salesforce disabling TLS1.0 on July 22, 2017. All application connecting to Salesforce should support TLS1.1 and above. We had to upgrade our PI server to support this.

4. Processing limitations on salesforce side: Salesforce cannot process big files in one request using SOAP adapter, it can process only 200 records in one request. I had to split the file on the sender communication channel to achieve this.

Comments are closed.