Announcing the Saviynt Knowledge Exchange unifying the Saviynt forums, documentation, training,
and more in a single search tool across platforms. Read the announcement here.

Set Cookie in a SOAP Connector (Connecting to SuccessFactors using SOAP Connector)?

yusufw
New Contributor III
New Contributor III

I am tasked with configuring the SOAP Connector to connect to a SuccessFactors (SF) endpoint. I am using the SOAP Connector because the data of interest is in the CompoundEmployee API, which uses a SOAP transport. If I use the SuccessFactors REST Connector, I will have to call 3 different endpoints instead of 1, and I'll have to do additional processing using the inline preprocessor to filter data.

To query SF, I have to send a login request to get the session id (or Cookie), and then use the Cookie in the subsequent query call. See link for an example of how to do this using SOAP UI. As seen in the link, if I get the sessionID from the login call, I'll have to add a cookie JSESSIONID=<the session id>. If I used Postman to POST the login soap request, I'll have a cookie that I can use in the query call.

  1. How can I fix the error below?
  2. How can I set the cookie in the query call in the SOAP connector? My current configuration does not work.

My SOAP request looks like this:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:sfobject.sfapi.successfactors.com">
<soapenv:Header/>
<soapenv:Body>
<urn:query>
<urn:queryString>
SELECT person, personal_information, employment_information,job_information
FROM CompoundEmployee
WHERE user_id = '9999'
</urn:queryString>
</urn:query>
</soapenv:Body>
</soapenv:Envelope>

and the SF API document doesn't specify how to set the cookie in the SOAP header.

When I submit the request using SOAP UI, the http log looks like this:

Thu Nov 17 14:34:11 EST 2022: DEBUG: http-outgoing >> 
POST /sfapi/v1/soap HTTP/1.1
Accept-Encoding: gzip,deflate
Content-Type: text/xml;charset=UTF-8
SOAPAction: ""
Cookie: JSESSIONID=3C475EF229B62574ABCDEFGJ.pcpcpcp#Matrixqa
Content-Length: 776
Host: api4.successfactors.com:443
Connection: Keep-Alive
User-Agent: Apache-HttpClient/4.5.5 (Java/16.0.1)

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:sfobject.sfapi.successfactors.com">
<soapenv:Header/>
<soapenv:Body>
<urn:query>
<urn:queryString>
SELECT person, personal_information, employment_information,job_information
FROM CompoundEmployee
WHERE user_id = '9999'
ORDER by start_date DESC
</urn:queryString>

When I run a UserImport job with my configuration, I got the following error:

Error - Failed to Connect to or Import SOAP Data : java.lang.Exception: Error while calling webservice https://api4.successfactors.com:443:AxisFault: faultCode:
{http://schemas.xmlsoap.org/soap/envelope/}Server.
userException faultString: org.xml.sax.SAXException: Processing instructions are not allowed within SOAP messages faultDetail:xmlns="http://xml.apache.org/axis/">org.xml.sax.SAXException: Processing instructions are not allowed within SOAP messages

Here's my SOAP Connector configuration:

SOAP_ENDPOINT: https://api4.successfactors.com:443/sfapi/v1/soap

SOAP_OR_XML: SOAP

HR_IMPORT_JSON:
{
"CONNECTION1": "login",
"REQUESTXML1": "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:urn=\"urn:sfobject.sfapi.successfactors.com/\"><soapenv:Header/><soapenv:Body><urn:login><urn:credential><urn:companyId>MyCompany</urn:companyId><urn:username>$(USERNAME}</urn:username><urn:password>${PASSWORD}</urn:password></urn:credential></urn:login></soapenv:Body></soapenv:Envelope>",
"COOKIEOPTIONS1": "SAVEFROMRESPONSE",
"REQUESTPARAMS1": {
"Content-Type": "text/xml; charset=utf-8"
},
"RESPONSEDATAPATH1": "Body.LoginResponse.result",
"RESPONSEMAPPING1": {
"TOKEN": "sessionId"
},
"CONNECTION2": "gethrdata",
"REQUESTXML2": "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:urn=\"urn:sfobject.sfapi.successfactors.com\"><soapenv:Header/><soapenv:Body><urn:query><urn:queryString>SELECT person, personal_information, employment_information,job_information FROM CompoundEmployee WHERE person_id_external = \'9999\' ORDER BY start_date DESC</urn:queryString></urn:query></soapenv:Body></soapenv:Envelope>",
"COOKIEOPTIONS2": "SENDFROMSAVED",
"REQUESTPARAMS2" : {
"Content-Type" : "text/xml; charset=utf-8"
},
"RESPONSEDATAPATH2": "Body.queryResponse.result.sfobject",
"USERMAPPING1": "USERNAME:person.person_id,SYSTEMUSERNAME:person.person_id"
}

Application Logs:

when SOAP_OR_XML: XML

log":"2022-11-18 00:40:55 115 [quartzScheduler_Worker-6] DEBUG provisoning.SoapProvisioningService - End getting JSON for CUSTOM_CONFIG\n"
log":"2022-11-18 00:40:55 115 [quartzScheduler_Worker-6] DEBUG provisoning.SoapProvisioningService - Request# 1\n"
log":"2022-11-18 00:40:55 115 [quartzScheduler_Worker-6] DEBUG provisoning.SoapProvisioningService - Start processSingleRequest\n"
log":"2022-11-18 00:40:55 115 [quartzScheduler_Worker-6] DEBUG provisoning.SoapProvisioningService - Getting data for request# 1\n"
log":"2022-11-18 00:40:55 115 [quartzScheduler_Worker-6] DEBUG provisoning.SoapProvisioningService - Page Number: 1\n"
log":"2022-11-18 00:40:55 116 [quartzScheduler_Worker-6] DEBUG provisoning.SoapProvisioningService - Calling URL: https://api4.successfactors.com:443\n"
log":"2022-11-18 00:40:55 694 [quartzScheduler_Worker-6] DEBUG provisoning.SoapProvisioningService - Response Code: 200
log":"2022-11-18 00:40:55 694 [quartzScheduler_Worker-6] DEBUG provisoning.SoapProvisioningService - Response length: 923\n"
log":"2022-11-18 00:40:55 711 [quartzScheduler_Worker-6] ERROR provisoning.SoapProvisioningService - Error in parsing response xml: \n"
log":"org.xml.sax.SAXParseException; lineNumber: 4; columnNumber: 10; DOCTYPE is disallowed when the feature \"http://apache.org/xml/features/disallow-doctype-decl\" set to true.\n" stream:"stdout"
log":"\u0009at com.saviynt.provisoning.SoapProvisioningService.processSingleRequest(SoapProvisioningService.groovy:1165)\n" stream:"stdout"
log":"\u0009at com.saviynt.provisoning.SoapProvisioningService.importXMLData(SoapProvisioningService.groovy:843)\n" stream:"stdout"
-- snip -- snip --
log":"2022-11-18 00:40:55 712 [quartzScheduler_Worker-6] DEBUG provisoning.SoapProvisioningService - Error - Failed to Connect to or Import Data : \n"

When SOAP_OR_XML: SOAP

log":"2022-11-18 00:46:48 320 [quartzScheduler_Worker-5] DEBUG provisoning.SoapProvisioningService - Calling SOAP Webservice: https://api4.successfactors.com:443\n"
log":"2022-11-18 00:46:48 320 [quartzScheduler_Worker-5] DEBUG provisoning.SoapProvisioningService - SOAPACTION null\n"
log":"2022-11-18 00:46:48 536 [quartzScheduler_Worker-5] ERROR provisoning.SoapProvisioningService - Error while calling webservice https://api4.successfactors.com:443: \n"
log":"AxisFault\n" stream:"stdout"
log":" faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.userException\n" stream:"stdout"
log":" faultSubcode: \n" stream:"stdout"
log":" faultString: org.xml.sax.SAXException: Processing instructions are not allowed within SOAP messages\n" stream:"stdout"
log":" faultActor: \n" stream:"stdout"
log":" faultNode: \n" stream:"stdout"
log":" faultDetail: \n" stream:"stdout"
log":"\u0009{http://xml.apache.org/axis/}stackTrace:org.xml.sax.SAXException: Processing instructions are not allowed within SOAP messages\n" stream:"stdout"
log":"\u0009at org.apache.axis.encoding.DeserializationContext.startDTD(DeserializationContext.java:1161)\n" stream:"stdout"
log":"\u0009at org.apache.xerces.parsers.AbstractSAXParser.doctypeDecl(Unknown Source)\n" stream:"stdout"
log":"\u0009at org.apache.xerces.impl.dtd.XMLDTDValidator.doctypeDecl(Unknown Source)\n" stream:"stdout"
-- snip -- snip --
log":"\u0009at org.apache.axis.SOAPPart.getAsSOAPEnvelope(SOAPPart.java:696)\n" stream:"stdout"
log":"\u0009... 15 more\n" stream:"stdout"
log":"2022-11-18 00:46:48 541 [quartzScheduler_Worker-5] DEBUG provisoning.SoapProvisioningService - Error - Failed to Connect to or Import Data : \n"
log":"java.lang.Exception: java.lang.Exception: Error while calling webservice https://api4.successfactors.com:443: AxisFault:\n" stream:"stdout"
log":"faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.userException\n" stream:"stdout"
log":"faultString: org.xml.sax.SAXException: Processing instructions are not allowed within SOAP messages\n" stream:"stdout"
log":"faultDetail: \u003c?xml version=\"1.0\" encoding=\"UTF-8\"?\u003e\u003cstackTrace xmlns=\"http://xml.apache.org/axis/\"\u003eorg.xml.sax.SAXException: Processing instructions are not allowed within SOAP messages\n" stream:"stdout"
log":"\u0009at com.saviynt.provisoning.SoapProvisioningService.processSingleRequest(SoapProvisioningService.groovy:1144)\n" stream:"stdout"
-- snip -- snip --
log":"2022-11-18 00:46:48 542 [quartzScheduler_Worker-5] DEBUG provisoning.SoapProvisioningService - Dropping temp tables\n"
log":"2022-11-18 00:46:48 542 [quartzScheduler_Worker-5] DEBUG provisoning.SoapProvisioningService - Executing Qry: DROP TABLE IF EXISTS TEMPENTITLEMENT_VALUES_73757\n"
log":"2022-11-18 00:46:48 550 [quartzScheduler_Worker-5] DEBUG provisoning.SoapProvisioningService - Executing Qry: DROP TABLE IF EXISTS TEMPACCOUNT_ENTITLEMENTS1_73757\n"
log":"2022-11-18 00:46:48 556 [quartzScheduler_Worker-5] DEBUG services.ImportUtilityService - Writing job history to import logs.\n"
log":"2022-11-18 00:46:48 556 [quartzScheduler_Worker-5] DEBUG services.ImportUtilityService - Number of log entries to be written : 1\n"
log":"2022-11-18 00:46:48 562 [quartzScheduler_Worker-5] DEBUG provisoning.SoapProvisioningService - SOAP import Ended - Fri Nov 18 00:46:48 UTC 2022\n"
log":"2022-11-18 00:46:48 562 [quartzScheduler_Worker-5] DEBUG integration.ExternalConnectionCallService - END IMPORT USER USING EXTERNAL CONNECTION\n"
log":"2022-11-18 00:46:48 562 [quartzScheduler_Worker-5] DEBUG jobs.UserImportJob - End call externalConnectionCallService\n"
log":"2022-11-18 00:46:48 562 [quartzScheduler_Worker-5] DEBUG jobs.UserImportJob - Setting ecmImportJob enddate: Fri Nov 18 00:46:48 UTC 2022\n"
log":"2022-11-18 00:46:48 562 [quartzScheduler_Worker-5] DEBUG jobs.UserImportJob - Done setting ecmImportJob enddate\n"
log":"2022-11-18 00:46:48 567 [quartzScheduler_Worker-5] DEBUG jobs.UserImportJob - Import status :: Error - Failed to Connect to or Import SOAP Data : java.lang.Exception: Error while calling webservice https://api4.successfactors.com:443: AxisFault:\n"
log":"faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.userException\n" stream:"stdout"
2 REPLIES 2

yusufw
New Contributor III
New Contributor III

Instead of using the SOAP Connector to connect to SuccessFactors, I began to use the REST Connector. In the URL, I had to pass expand=empInfo/jobInfoNav to get the data needed.

https://api.successfactors.com/odata/v2/User?%24expand=empInfo/jobInfoNav

Manu269
All-Star
All-Star

@yusufwi am attaching a sample json that might help you.

Regards
Manish Kumar
If the response answered your query, please Accept As Solution and Kudos
.