Technology Blogs by Members
Explore a vibrant mix of technical expertise, industry insights, and tech buzz in member blogs covering SAP products, technology, and events. Get in the mix!
cancel
Showing results for 
Search instead for 
Did you mean: 
NishantChavan
Participant
I have recently accomplished 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.

  1. Get session ID using login request (Salesforce generates new session id every few hours, this is configurable in Salesforce)

  2. Actual post/update request using session id retrieved from the first step


Steps:

  1. Get Salesforce WSDL: Request Salesforce WSDL from Salesforce team or download it, here are the steps to download if you have access to Salesforce server


    1. Log in to your Salesforce developer organization in your browser.

    2. From Setup, enter "API" in the Quick Find box, then select API.

    3. Download the appropriate WSDL files for the API you want to use.



  2. 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 login with the username and password. Please note the password is "password + Security Token"

  3. Create WSDL/XSD: We cannot directly use the Salesforce WSDL in ESR if we are doing graphical mapping because it does not give the structure. I have created this with below steps.

    1. Created successful/working upsert request using SOAPui

    2. Created XSD for that request using external tools (jedit/XMLSpy) or tools available on the internet.



  4. 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:

  5. 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



  6. 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.

  7. API lookup code to get sessionid and server URL: Here is the code, this is also available on other 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 +
    "</password></login>";
    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) {
    getTrace().addDebugMessage(e.toString());
    e.printStackTrace();
    }

    return sessionId;

    Communication channel for lookup:


  8. 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.

5. We did the deployment first before upgrading TLS to TLS1.2, the interface failed when we actually upgraded TLS. To solve the problem, I had to delete the Lookup channel and recreate it.

 
4 Comments
Labels in this area