I am implementing my own SOAP API with Salesforce. I am not using the Salesforce PHP Client add-on.
I am trying to create a new object, such as a Contact or Lead, via the API.
My code to POST the sessionId and new Contact information.
$soapVar = array('parameters'=>array('sessionId' => 'sessionId', 'Contact' => array('Company' => 'Test', 'LastName' => 'Last Name')));
$client = new SoapClient("wsdl file", null);
$header = new SoapHeader("[serverUrl]", "AuthHeader", $soapVar, false)l
$client->__setLocation("[serverUrl]");
$result = __soapCall("create, $soapVar");
print_r($result;)
I get the following error: Uncaught SoapFault exception: [soapenv:Client] No operation available for request {urn:enterprise.soap.sforce.com}create
Where am I supposed to be posting to and what am I doing wrong?
When I login through SOAP to request a sessionId and the location, I get the sessionId and the serverUrl is https://xx.salesforce.com/services/Soap/m/27.0/xxxxx
I am using the Sandbox mode.
Thanks!
Best Answer
Not sure why you're not using the PHP Toolkit, but here's some PHP that creates a Contact.
First, with the Enterprise SOAP API
And the same thing, with the Partner SOAP API: