Currently Being Moderated

Salesforce.com offers technology solution which support CRM of an organization. In addition to the web interface, salesforce.com offers a SOAP/REST Web service API that enables integration with other systems. SAP-PI uses SOAP [3] to interact with Salesforce.com. This article does not intend to build up SAP-PI and Salesforce.com integration scenario. In case you need details on how to set up exchange of messages between SAP-PI and Salesforce.com then please refer to points  [1] and [2] in reference section. After a scenario is built in SAP-PI to communicate with Salesforce.com then comes the responsibility of maintaining such connection. Periodically there are refresh happening in Salesforce Sandbox database to bring it in sync with production Salesforce database. After such refresh there might be problems for SAP-PI to connect or communicate with Salesforce.com using SOAP receiver adapter. This article describes SOAP faults while SAP-PI is trying to communicate with Salesforce.com and possible steps to resolve the errors. I am just sharing my experiences with SCN , the various trouble shooting I had to perform for maintenance of SAP-PI and SFDC(salesforce.com) integration scenario. If you feel this this article is helpful then all credits goes to my team members who have always provided me unending help and support.

 

 

SAP-PI integrates Salesforce.com (SFDC) with SAP-ISU. The manner is explained in this figure below

 

sfdc general pic.jpg

 

In most of the projects there will be development, acceptance and production servers. SAP-PI development and acceptance server would connect to Sandbox URL of Salesforce.com whereas production server will connect to different URL. Salesforce gives us the ability to create multiple copies of our organization in separate environments for a variety of purposes, such as testing and training, without compromising the data and applications in our Salesforce production organization. These copies are called sandboxes and are nearly identical to our Salesforce production organization. Sandboxes are completely isolated from Salesforce production organization, so operations performed in sandboxes do not affect the Salesforce production organization, and vice versa. The URL to which PI server connects to production environment is different from the URL used to connect to sandbox server. After some definite intervals of time production data instance is copied into sandbox data instance. This is done to provide more realistic data for test environment in development system. Salesforce stores sandbox organizations on several instances. When a sandbox is created or refreshed, an instance is selected for the sandbox, so our sandbox may appear on different instances and have different URLs. This article mainly tends to describe problems SAP-PI might face after a refresh and how to resolve them.

 

The sequence of events that happen while SAP-PI tries to communicate with Salesforce and do a simple query on contacts object (for example) is as shown below. 

flowchart.png

Problem 1

After sandbox refresh in development environment of SFDC the SOAP fault message during login is as shown below

 

 

<? xml version="1.0" encoding="UTF-8" standalone="yes" ?> 
  <SAP: Error xmlns:SAP="http://sap.com/xi/XI/Message/30"
  xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/" SOAP:mustUnderstand="1">
  <SAP:Category>Application</SAP:Category> 
  <SAP:Code area="UNKNOWN">APPLICATION_ERROR</SAP:Code> 
  <SAP:P1 /> 
  <SAP:P2 /> 
  <SAP:P3 /> 
  <SAP:P4 /> 
  <SAP:AdditionalText>application fault</SAP:AdditionalText> 
  <SAP:ApplicationFaultMessage namespace="urn:fault.enterprise.soap.sforce.com">LoginFault</SAP:ApplicationFaultMessage> 
  <SAP:Stack /> 
  <SAP:Retry>M</SAP:Retry> 
  </SAP:Error>

 

In SXMB_MONI error symbols like this  sxmberror.png            may be obtained.

 

Solution:

 

  1. Need to login to Salesforce.com sandbox server as administrator, then need to go to Setup -> App set up -> Develop --> API -> Generate Enterprise WSDL àgenerate

as shown below

 

sfdc.png

 

 

The WSDL will be in form of XML. At the end of the WSDL tag “service” can be seen.

Here a sample service tag is being shown. 

 

<service name="SforceService">
     <documentation>Sforce SOAP API</documentation> 
     <port binding="tns: SoapBinding" name="Soap">
     <soap: address location="https://XYZ.salesforce.com/services/Soap/c/24.0/0CG30000888Pm5T" /> 
     </port>
</service>

 

The important part of service tag is the portion “soap: address”.  The URL to the Salesforce server is obtained in “location” attribute. This URL has to be in target URL of SOAP receiver adapter meant for logging in to salesforce.com.

 

N.B- In case of Sandbox database refresh message structure is not expected to change. Thus there is no need to re-import the enterprise WSDL in SAP-PI server and redo all mappings again

 

 

Problem 2

 

After the target URL for Login has been changed. Then SAP-PI tries to make a query to Contacts object within SFDC. The manner in which request was made prior to SFDC refresh is shown below

 

 

 <? xml version="1.0" encoding="utf-8" ?> 
    <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
  xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
 <soapenv: Header>
 <SessionHeader xmlns:ns1="urn:horizon:sessionmgmt" 
 soapenv:actor="http://schemas.xmlsoap.org/soap/actor/next" soapenv:mustUnderstand="0">
  <ns1:sessionId>2TjsllIJRC_3Uvo.ZLLEWb9ed7igHX2aarxpWzrgUeOJWh1AwrqnR.ZwvbKa0Gb8ueHy</ns1:sessionId> 
  </SessionHeader>
  </soapenv:Header>
 <soapenv:Body>
 <query xmlns="urn:enterprise.soap.sforce.com">
  <queryString>Select Id, HasOptedOutOfEmail FROM Contact </queryString> 
  </query>
  </soapenv:Body>
  </soapenv:Envelope>

 

The response to this message was a SOAP fault message as shown here

 

    <?xml version="1.0" encoding="UTF-8" standalone="yes" ?> 
 <SAP:Error xmlns:SAP="http://sap.com/xi/XI/Message/30" 
 xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/" SOAP:mustUnderstand="1">
  <SAP:Category>XIAdapter</SAP:Category> 
  <SAP:Code area="HTTP">ADAPTER.HTTP_EXCEPTION</SAP:Code> 
  <SAP:P1 /> 
  <SAP:P2 /> 
  <SAP:P3 /> 
  <SAP:P4 /> 
  <SAP:AdditionalText>HTTP 500 Internal Server Error</SAP:AdditionalText> 
  <SAP:ApplicationFaultMessage namespace="" /> 
  <SAP:Stack /> 
  <SAP:Retry>M</SAP:Retry> 
  </SAP:Error>

In the response message payloads main attachment this XML message was shown

 

<?xml version="1.0" encoding="UTF-8" ?> 
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:sf="urn:fault.enterprise.soap.sforce.com" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Body>
 <soapenv:Fault>
  <faultcode>sf:INVALID_SESSION_ID</faultcode> 
  <faultstring>INVALID_SESSION_ID: Invalid Session ID found in SessionHeader: Illegal Session</faultstring> 
 <detail>
 <sf:UnexpectedErrorFault xsi:type="sf:UnexpectedErrorFault">
  <sf:exceptionCode>INVALID_SESSION_ID</sf:exceptionCode> 
  <sf:exceptionMessage>Invalid Session ID found in SessionHeader: Illegal Session</sf:exceptionMessage> 
  </sf:UnexpectedErrorFault>
  </detail>
  </soapenv:Fault>
  </soapenv:Body>
  </soapenv:Envelope>

 

Solution

This error is quite misleading as the session ID supplied is a valid one. Thus the error message may not be showing the exact reason of SOAP Fault. Install the SOAPUI tool in local system [4] . Import the latest enterprise WSDL into the SOAP UI tool and set up proxy server details if any. This is because this helps to find out the exact structure of the SOAP message being accepted by Salesforce.com after sandbox refresh activity. There cannot be any change in number of tags or name of tags in SOAP message. Thus changes might be in namespace information. This has to be identified.

Go to file ànew Soap UI project à give  a project name and import WSDL in form of XML file. The XML file can be formed by saving the generated WSDL file.Under each project there will be operations such as login, logout ,query etc. Right click on query and generate new instance of query. You might need to delete excess fields to create the exact message structure as per query structure in SAP-PI. Thus after modification contact query in SOAP UI tool was looking something like this

 

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" 
 xmlns:urn="urn:enterprise.soap.sforce.com">
   <soapenv:Header>
      <urn:SessionHeader>
         <urn:sessionId></urn:sessionId>
      </urn:SessionHeader>
   </soapenv:Header>
   <soapenv:Body>
      <urn:query>
         <urn:queryString>?</urn:queryString>
      </urn:query>
   </soapenv:Body>
</soapenv:Envelope>

 

 

If noted carefully the message structure shown above the default namespace is "urn:enterprise.soap.sforce.com” and tag “SessionHeader” is identified by same default namespace. Thus on comparison with first xml message shown under problem 2  , the namespace information is different for  “SessionHeader” as there is no namespace information attached to it.Using java or XSLT mapping the namespace information has to be added.

Following is the change in message namespace information before and after SFDC sandbox refresh.

 

 

<soapenv:Header>
<SessionHeader xmlns:ns1="urn:horizon:sessionmgmt" 
 soapenv:actor="http://schemas.xmlsoap.org/soap/actor/next" soapenv:mustUnderstand="0">
 <ns1:sessionId>00DW0000000CxdG!AQUAQJbFcBi45eGiXFoIlSj47fJl2TjsllIJRC_3Uvo.ZLLEWb9ed7igHX2aarxpWzrgUeOJWh1AwrqnR.ZwvbKa0Gb8ueHy</ns1:sessionId> 
 </SessionHeader>
 </soapenv:Header>

 

     After SFDC sandbox refresh new SOAP header with default namespace information it becomes as shown below

<soapenv:Header xmlns="urn:enterprise.soap.sforce.com">
 <SessionHeader xmlns:ns1="urn:horizon:sessionmgmt" 
 soapenv:actor="http://schemas.xmlsoap.org/soap/actor/next" soapenv:mustUnderstand="0">
  <ns1:sessionId>9ed7igHX2aarxpWzrgUeOJWh1AwrqnR.ZwvbKa0Gb8ueHy</ns1:sessionId> 
  </SessionHeader>

   

This resolves the problem due to slight change in default namespace. Once correct SOAP message from SAP-PI is sent the SOAP fault is avoided.

 

Problem 3

 

There might be SOAP faults even after this corrections as shown below

 

<?xml version="1.0" encoding="UTF-8" ?> 
 <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
  xmlns:sf="urn:fault.enterprise.soap.sforce.com" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
 <soapenv:Body>
 <soapenv:Fault>
  <faultcode>sf:INVALID_FIELD</faultcode> 
  <faultstring>INVALID_FIELD: Description, CurrencyIsoCode, OwnerId, HasOptedOutOfEmail, CreatedDate ^ 
 ERROR at Row:1:Column:380 No such column 'HasOptedOutOfEmail' on entity 'Contact'.
  If you are attempting to use a custom field, be sure to append the '__c' after the custom field name. 
 Please reference your WSDL or the describe call for the appropriate names.</faultstring> 
 <detail>
 <sf:InvalidFieldFault xsi:type="sf:InvalidFieldFault">
  <sf:exceptionCode>INVALID_FIELD</sf:exceptionCode> 
  <sf:exceptionMessage>Description, CurrencyIsoCode, OwnerId, HasOptedOutOfEmail, CreatedDate ^ ERROR at Row:1:Column:380 No such column 'HasOptedOutOfEmail' on entity 'Contact'. If you are attempting to use a custom field, be sure to append the '__c' after the custom field name. Please reference your WSDL or the describe call for the appropriate names.
</sf:exceptionMessage> 
  <sf:row>1</sf:row> 
  <sf:column>380</sf:column> 
  </sf:InvalidFieldFault>
  </detail>
  </soapenv:Fault>
  </soapenv:Body>
  </soapenv:Envelope>

 

Solution

 

       The fault string says that a particular field  “HasOptedOutOfEmail” is an invalid. Now this used to be valid field earlier. In this case the user ID with which SAP-PI is accessing Salesforce.com may not have field level access permission. The permission has to be given from Salesforce team.

 

               Problem 4

 

You might receive a SOAP fault with following message

 

iou   

<?xml version="1.0" encoding="UTF-8" ?> 
 <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" 
 xmlns:sf="urn:fault.enterprise.soap.sforce.com" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
 <soapenv:Body>
 <soapenv:Fault>
  <faultcode>sf:INVALID_OPERATION_WITH_EXPIRED_PASSWORD</faultcode> 
  <faultstring>INVALID_OPERATION_WITH_EXPIRED_PASSWORD: The users password has expired, 
 you must call SetPassword before attempting any other API operations</faultstring> 
 <detail>
 <sf:UnexpectedErrorFault xsi:type="sf:UnexpectedErrorFault">
  <sf:exceptionCode>INVALID_OPERATION_WITH_EXPIRED_PASSWORD</sf:exceptionCode> 
  <sf:exceptionMessage>The users password has expired, 
 you must call SetPassword before attempting any other API operations</sf:exceptionMessage> 
  </sf:UnexpectedErrorFault>
  </detail>
  </soapenv:Fault>
  </soapenv:Body>
  </soapenv:Envelope>

 

Solution

 

Every time SAP-PI tries to login to SFDC server it has to login using a user credential.

The user credential has login id and password.  This issue was reported for production server. While checking development environment SAP-PI server which is connected to Salesforce.com sandbox environment it was found same SOAP fault is being observed here too. The Salesforce team reset the password for same user in Sandbox system and set it to  “Password Never Expires”  capability. After resetting the user password in sandbox followed by changes in development SAP-PI server, the production SAP-PI server also stopped giving errors. I have no clues if the user credentials in sandbox environment have any logical connection to production environment of Salesforce.com but at least it resolved the error in production SAP-PI too.

 

Problem 5

 

You might receive error message as shown below

<?xml version="1.0" encoding="UTF-8" standalone="yes" ?> 
 <SAP:Error xmlns:SAP="http://sap.com/xi/XI/Message/30" 
 xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/" SOAP:mustUnderstand="1">
  <SAP:Category>XIAdapterFramework</SAP:Category> 
  <SAP:Code area="MESSAGE">GENERAL</SAP:Code> 
  <SAP:P1 /> 
  <SAP:P2 /> 
  <SAP:P3 /> 
  <SAP:P4 /> 
  <SAP:AdditionalText>com.sap.aii.af.ra.ms.api.DeliveryException: unable to create a socket</SAP:AdditionalText> 
  <SAP:ApplicationFaultMessage namespace="" /> 
  <SAP:Stack /> 
  <SAP:Retry>M</SAP:Retry> 
  </SAP:Error>

 

 

 

 

    Solution:  We always connect to Salesforce server from specific protected network. Thus all SOAP request has to pass through proxy server. If the proxy server does not allow the SOAP request to flow through you will receive errors as shown above. This is either due to the fact that proxy server details mentioned in SOAP receiver communication channel is not correct, authentication error etc. In this case you need to consult the network team to resolve the issue.

 

 

 

Problem 6

 

 

    You might get an error message like this as shown below

<?xml version="1.0" encoding="UTF-8" standalone="yes" ?> 
<SAP:Error xmlns:SAP="http://sap.com/xi/XI/Message/30" 
 xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/" SOAP:mustUnderstand="1">
  <SAP:Category>XIServer</SAP:Category> 
  <SAP:Code area="INTERNAL">PL_TIMEOUT</SAP:Code> 
  <SAP:P1 /> 
  <SAP:P2 /> 
  <SAP:P3 /> 
  <SAP:P4 /> 
  <SAP:AdditionalText /> 
  <SAP:ApplicationFaultMessage namespace="" /> 
  <SAP:Stack>Timeout condition of pipeline reached</SAP:Stack> 
  <SAP:Retry>N</SAP:Retry> 
  </SAP:Error>

 

 

 

 

        Solution: - SAP-BASIS team restarted the java stack of the PI server and the error is gone.

     

       .

Problem 7

 

   After all troubleshooting again you are getting the same error “login Fault” as shown in problem 1

Solution: Every time SAP-PI tries to login to SFDC server it has to login using a user credential. The user credential has login id and password which is fixed. The business has to register with salesforce.com for its services. After a definite period of time the registration has to be renewed. Thus check with salesforce.com team if the business has to re-register with salesforce.com or not. The exact cause of such fault will be shown to you if you try logging in to salesforce.com using the login credentials directly and not through SAP-PI

 

Problem 8

     After all troubleshooting again you are getting the same error “Invalid Session ID found in SessionHeader: Illegal Session” as   shown   in problem 2

Solution: Every time SAP-PI tries to login to SFDC server it has to login using a user credential. The user credential has login id and password which is fixed. Say for example you are using xyzuser@sgd.com  credentials to login to salesforce.com through SAP-PI. Thus the SOAP login request to SFDC carries the name xyzuser@sgd.com  .  Now while SAP-PI is trying to connect to Salesforce.com at the time the user xyzuser@sgd.com   is trying to login to salesforce.com directly, then it’s possible you can receive this error. Thus you need to ensure that login credential used by SAP-PI to login to Salesforce.com is not used to login to salesforce.com directly.

 

 

 

  

 

  

 

 

 

 

 

 

 

         References

 

 

            1. http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/802f8d03-9282-2d10-52b4-f9446e077099?QuickLink=index&overridelayout=true

  2.       2. http://www.sdn.sap.com/irj/scn/index?rid=/library/uuid/50a76cfa-4966-2d10-aba7-da496d9b5bcf

            3. http://www.w3.org/TR/2000/NOTE-SOAP-20000508/

            4. http://www.soapui.org/

 

 

RefR

Comments

Actions

Filter Blog

By author:
By date:
By tag: