You need to sign in to do that
Don't have an account?

PHP stand-alone Partner client based on NuSOAP
Hi,
I've written a small sforce Partner WSDL PHP library based on the NuSOAP SOAP Toolkit. It obviates the need for PHP 5 and PEAR. All you need is the salesforce.php and nusoap.php files, both of which are included in the attached zip file. Download the zip from sourceforge at:
http://osdn.dl.sourceforge.net/sourceforge/sforce/php.sforce.nusoap.20051012.zip
Most of the API methods have been implemented; feel free to recommend more. The goal of this library was to make the basic operations -- create, update, delete, query, search -- easy to do. A lot of the response objects are still native PHP types. However, I've made a point of declaring a sObject class and returning it wherever possible.
I've also included an example php file and the original nusoap.php file, so you can see what modifications I've made.
Please send comments and feedback to rchoi21_AT_hotmail.com.
Thanks!
Ryan Choi
rchoi21_AT_hotmail.com
(Sorry for the re-post. Wouldn't let me edit the URL to point to sourceforge.)
I've written a small sforce Partner WSDL PHP library based on the NuSOAP SOAP Toolkit. It obviates the need for PHP 5 and PEAR. All you need is the salesforce.php and nusoap.php files, both of which are included in the attached zip file. Download the zip from sourceforge at:
http://osdn.dl.sourceforge.net/sourceforge/sforce/php.sforce.nusoap.20051012.zip
Most of the API methods have been implemented; feel free to recommend more. The goal of this library was to make the basic operations -- create, update, delete, query, search -- easy to do. A lot of the response objects are still native PHP types. However, I've made a point of declaring a sObject class and returning it wherever possible.
I've also included an example php file and the original nusoap.php file, so you can see what modifications I've made.
Please send comments and feedback to rchoi21_AT_hotmail.com.
Thanks!
Ryan Choi
rchoi21_AT_hotmail.com
(Sorry for the re-post. Wouldn't let me edit the URL to point to sourceforge.)
However, I would like to emulate the process provided by php-client by being able to submit requests that provide a sessionId (and endpoint), instead of logging in first. I am trying to embed my application/product within SF, accessible via its own web tab.
I have started with the following. Variables $ah_sess_id and $sf_endpoint come from web tab parameters.
$COLUMNS = 'Id,FirstName,LastName,Email';
$DATATYPE = 'Contact';
$LIMIT = 200;
$query_str = "select $COLUMNS from $DATATYPE";
$wsdl_url = "http://my/url/for/sforce_partner.wsdl";
$sfdc = new salesforce($wsdl_url);
$element = new soapval('sessionId', null, $ah_sess_id);
$element = array($element);
$sfdc->setHeader('SessionHeader', $element);
if (isset($QUERY_LOCATOR)) {
$result = $sfdc->queryMore($QUERY_LOCATOR,$LIMIT);
} else {
$result = $sfdc->query($query_str,$LIMIT);
}
The above gives me error "UNKNOWN_EXCEPTION: Destination URL not reset. The URL returned from login must be set in the SforceService"
How do I set the endpoint URL?
Colin Goldberg
http://sourceforge.net/project/showfiles.php?group_id=96634&package_id=166314
Message Edited by rchoi21 on 10-27-2005 01:58 PM
http://sourceforge.net/project/showfiles.php?group_id=96634&package_id=166314
Message Edited by rchoi21 on 10-27-2005 01:58 PM
Fatal error: Cannot redeclare class soapclient in C:\Program Files\xampp\htdocs\sforcePHP\nusoap.php on line 7276
The code DOES work when I upload the PHP files to my web host. However, I'd like to be able to work locally rather than keep uploading the files everytime I need to test.
Any ideas?
I didn't resolve my issue, but I was able to get the connector working when I used PHP 4.3.4. PHP 5.0.5 did not work and I am not exactly sure why that is. I believe that PHP 5.0.5 replaced NUSOAP with another SOAP package and the object name "soapclient" still exists.
I have a custom object called "Persons" (singular, Person) that I would like to update. The code I am running is:
$id = $_POST['Id'];
$person1 = new sObject('Person__c',
$id,
array(
'Address1__c' => 'new address1',
'Address2__c' => 'new address2'
),
array('State__c, 'Zip__c')
);
$updateResult = $sfdc->update($person1);
And I am getting the error
"Id not specified in an update call [statusCode] => MISSING_ARGUMENT) [id]"
Can you tell me what I am doing wrong?
Thanks
Is it possible that the NuSOAP update method is no longer compatible with the sfapi? The following seems to no longer work for me:
$contact1 = new sObject('lead',
$id,
array(
'Description' => 'My test',
'Email' => 'cwyatt123@blahblahblah.com',
$whitepaperval,
$interactivetour
),
array('Description', 'Email', 'white_paper__c', 'interactive_tour__c' );
$updateResult = $sfdc->update($contact1);
print_r("\nupdate one: \n\n");
print_r($updateResult);