function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Jean-NoelJean-Noel 

Salesforce PHP SOAP API - Unable to get custom WebService working

I have a PHP developer that need to use a webservice to enter information in Salesofrce. I've send to them  partner.wsdl and CatalystWebservice.wsdl files along with login details to my sandbox to run all this on. The PHP developer need to use the SOAP API of Salesforce and once connected and logged in he need to call ->makeContact("FormField1", "FormField2", "etc...");

 

So after spending all day trying many things to try to help him and hitting many problems he have finally hit a wall he cannot climb. Here is the PHP code he have now:

 

<pre>
<?php
define
("SOAP_CLIENT_BASEDIR","../soapclient");
$USERNAME
='******@********';
$PASSWORD
='******************************';
require_once
(SOAP_CLIENT_BASEDIR.'/SforcePartnerClient.php');
require_once
(SOAP_CLIENT_BASEDIR.'/SforceHeaderOptions.php');

try{

    $mySforceConnection
=newSforcePartnerClient();
    $mySoapClient
= $mySforceConnection->createConnection(SOAP_CLIENT_BASEDIR.'/partner2.wsdl.xml');
    $loginResult
= $mySforceConnection->login($USERNAME, $PASSWORD);

    $location
= $mySforceConnection->getLocation();
    $session_ID
= $mySforceConnection->getSessionId();

    $client
=newSoapClient(SOAP_CLIENT_BASEDIR.'/CatalystWebservice.wsdl.xml');
    $sforce_header
=newSoapHeader("http://soap.sforce.com/schemas/class/CatalystWebservice","SessionHeader", array("sessionId"=> $session_ID ));
    $client
->__setSoapHeaders( array( $sforce_header ));

    $client
->makeContact("*****","*****","Address1","Address2","London","****","no-one@****","0123456789","07891236456","New Build Homebuy","This is my question\n\nAnd an other line","1","Test");

}catch(Exception $e){
    print_r
($e);
}
?>
</pre>

I have starred out sensitive information for here. When I run the above code I get the following output:

SoapFaultObject
(
   
[message:protected]=> UNKNOWN_EXCEPTION:An unexpected error occurred.Please include thisErrorIdif you contact support:***********-***(***********)
   
[string:Exception:private]=>
   
[code:protected]=>0
   
[file:protected]=>/home/******/public_html/********/test/partner.php
   
[line:protected]=>23
   
[trace:Exception:private]=>Array
       
(
           
[0]=>Array
.....

 

From C#, I can call the webservice without any problem, have anyone an idea of the part that is missing in the PHP code ?

Best Answer chosen by Admin (Salesforce Developers) 
Jean-NoelJean-Noel

Solution found, PHP Error