You need to sign in to do that
Don't have an account?
JMcIvor
Failed Login Function PHP SOAP
We are experiencing an issue where sometimes we cannot log into SalesForce using the following code. It seems to work about 90-95% of the time, but every now and then it fails, and causes a 404 page – the error shown is “Could not connect to host.”. The username and password we’re using (i.e. $this->SF_username) are both valid as it works most of the time.
The issue seems to lie in the “$this->sforce->login” part of the following code, which I believe is handled on the SalesForce end. I can’t find any (code) declaration of that login() function in the “sforce” SoapClient object, though it is present in the “partner.wsdl.xml” XML file. I’ve tried assigning the result of “$this->sforce->login()” to a variable and printing it, but when the login() function fails, it doesn’t get that far, it just triggers the 404 page.
1)
file_one.php:
$mySforceConnection = $joomlaSf->getSFConnection();
2)
file_two.php:
function getSFConnection()
{
3)
SF_sync/soapclient/SforceBaseClient.php:
public function login($username, $password) {
Does anyone have any insight as to why this happens, and possible solutions to fix this?
The issue seems to lie in the “$this->sforce->login” part of the following code, which I believe is handled on the SalesForce end. I can’t find any (code) declaration of that login() function in the “sforce” SoapClient object, though it is present in the “partner.wsdl.xml” XML file. I’ve tried assigning the result of “$this->sforce->login()” to a variable and printing it, but when the login() function fails, it doesn’t get that far, it just triggers the 404 page.
1)
file_one.php:
$mySforceConnection = $joomlaSf->getSFConnection();
2)
file_two.php:
function getSFConnection()
{
if ($mySforceConnection->createConnection(JPATH_BASE . '/custom_files/SF_sync/soapclient/partner.wsdl.xml')) {
$mySforceConnection = new SforcePartnerClient();
$mySforceConnection->login($this->SF_username, $this->SF_password);
$mySforceConnection->login($this->SF_username, $this->SF_password);
}
}3)
SF_sync/soapclient/SforceBaseClient.php:
public function login($username, $password) {
$this->sforce->__setSoapHeaders(NULL);
if ($this->callOptions != NULL) {
if ($this->callOptions != NULL) {
$this->sforce->__setSoapHeaders(array($this->callOptions));
}
if ($this->loginScopeHeader != NULL) {
if ($this->loginScopeHeader != NULL) {
$this->sforce->__setSoapHeaders(array($this->loginScopeHeader));
}
// The following function seems to be causing the issue.
$result = $this->sforce->login(array (
// The following function seems to be causing the issue.
$result = $this->sforce->login(array (
'username' => $username,
'password' => $password
));
$result = $result->result;
$this->_setLoginHeader($result);
return $result;
}$result = $result->result;
$this->_setLoginHeader($result);
return $result;
Does anyone have any insight as to why this happens, and possible solutions to fix this?
Please check if Salesforce is expecting digital certificate to connect with SAlesforce allong with credentials.