You need to sign in to do that
Don't have an account?
Test Test
Fatal error:Call to a member function __setSoapHeaders() in sforceBaseclient.php
I am gettiong error: Fatal error: Call to a member function __setSoapHeaders() on a non-object in D:\xampp\htdocs\AvineKline\fsc\app\Model\Datasource\soapclient\SforceBaseClient.php on line 188 .I am using cakephp framework.when I try to add account data in salesforce account-list using create() method. this __setSoapHeaders() is in setHeader() function which gives this error.what is solution to this error?
Hi,
Can you please post the snap of code to investigate ?
In the sforceBaseclient.php,there is one function called setHeader() :
private function setHeaders($call=NULL) {
$this->sforce->__setSoapHeaders(null); [it gives above error.]
$header_array = array (
$this->sessionHeader
);
$header = $this->callOptions;
if ($header != NULL) {
array_push($header_array, $header);
}
if ($call == "create" ||
$call == "merge" ||
$call == "update" ||
$call == "upsert"
) {
$header = $this->assignmentRuleHeader;
if ($header != NULL) {
array_push($header_array, $header);
}
}
if ($call == "login") {
$header = $this->loginScopeHeader;
if ($header != NULL) {
array_push($header_array, $header);
}
}
if ($call == "create" ||
$call == "resetPassword" ||
$call == "update" ||
$call == "upsert"
) {
$header = $this->emailHeader;
if ($header != NULL) {
array_push($header_array, $header);
}
}
if ($call == "create" ||
$call == "merge" ||
$call == "query" ||
$call == "retrieve" ||
$call == "update" ||
$call == "upsert"
) {
$header = $this->mruHeader;
if ($header != NULL) {
array_push($header_array, $header);
}
}
if ($call == "delete") {
$header = $this->userTerritoryDeleteHeader;
if ($header != NULL) {
array_push($header_array, $header);
}
}
if ($call == "query" ||
$call == "queryMore" ||
$call == "retrieve") {
$header = $this->queryHeader;
if ($header != NULL) {
array_push($header_array, $header);
}
}
$this->sforce->__setSoapHeaders($header_array);
}
and I want to add Account details in the salesforce account as user get registered or do any transaction in our website. so i put following code in my Account model just for test , may be its creating any problem:
$mySforceConnection = new SforceEnterpriseClient();
$fieldsToUpdate
= array('AccountNumber'=>123456,'BillingCity'=>'Testcity','BillingCountry'=>'Testcountry','BirthDate'=>'27-04-1992');
$sObject = new stdClass();
$sObject->fields = $fieldsToUpdate;
$sObject->type = 'Case';
try {
$CreateResponse = $mySforceConnection->create(array ($sObject),'Account');
} catch (Exception $e) {
echo "<BR>Error Creating the Case! ";
echo $e->faultstring;
exit;
}
// Make sure the case was created successfully.
if($CreateResponse->success != 1) {
echo "<BR>Error Creating the case. ";
print_r($CreateResponse->errors->message);
exit;
}
// Get the Case ID of the succefully created case.
$CaseId = $CreateResponse->id;