You need to sign in to do that
Don't have an account?
statho
Problem with PEAR::SOAP library
Hi all,
I'm starting in Sforce API development and i faced my first problem.
I just scripted a simple connection code to start, using PEAR:SOAP library and a Sforce toolkitt
----------------------------code : exemple_pear.php-------------------------------
include_once('../SalesforceClient.php');
$login="X";
$mdp="Y";
$myConnection = new SalesforceClient();
$mySoapClient = $myConnection->SOAP_Client("partner.wsdl.xml",true);
$myLogin = $myConnection->login($login, $mdp);
if (PEAR::isError($myLogin))
{
$errors = $myLogin->getMessage()."\n";
print( "Problème lors de la connection ! Détails : $errors\n" );
}
else
{
print ('Connecté') ;
}
-----------------------------------------code--------------------------------------------------------
Error received ;
Warning: Invalid argument supplied for foreach() in /var/www/sdb/9/7/shinj/php-client-54/Client.php on line 512
Problème lors de la connection ! errors=Error:
--------------------------------------code : Client.php#line 512 ----------------------------------
[...]
// Get operation data.
$opData = $this->_wsdl->getOperationData($this->_portName, $method);
if (PEAR::isError($opData)) {
$fault =& $this->_raiseSoapFault($opData);
return $fault;
}
$namespace = $opData['namespace'];
$this->__options['style'] = $opData['style'];
$this->__options['use'] = $opData['input']['use'];
$this->__options['soapaction'] = $opData['soapAction'];
// Set input parameters.
if ($this->__options['input'] == 'parse') {
$this->__options['parameters'] = $opData['parameters'];
$nparams = array();
if (isset($opData['input']['parts']) &&
count($opData['input']['parts'])) {
$i = 0;
foreach ($opData['input']['parts'] as $name => $part) { //line 512
$xmlns = '';
$attrs = array();
// [...]
----------------------------------------/code---------------------------------------------------------------------
if i ask a print_r ($opData) it shows :
Array ( [soapAction] => [style] => document
[input] => Array ( [parts] => Aarameters
[use] => literal
[message] => loginRequest
[namespace] => tns )
[output] => Array ( [use] => literal
[message] => loginResponse
[namespace] => tns
[parts] => Array ( [result] => Array ( [name] => result
[type] => LoginResult
[namespace] => tns ) ) )
[fault] => Array ( [name] => UnexpectedErrorFault
[use] => literal )
[parameters] => 1
[namespace] => urn:partner.soap.sforce.com ) ;
Is someone has an idea ....
thanks
I'm starting in Sforce API development and i faced my first problem.
I just scripted a simple connection code to start, using PEAR:SOAP library and a Sforce toolkitt
----------------------------code : exemple_pear.php-------------------------------
include_once('../SalesforceClient.php');
$login="X";
$mdp="Y";
$myConnection = new SalesforceClient();
$mySoapClient = $myConnection->SOAP_Client("partner.wsdl.xml",true);
$myLogin = $myConnection->login($login, $mdp);
if (PEAR::isError($myLogin))
{
$errors = $myLogin->getMessage()."\n";
print( "Problème lors de la connection ! Détails : $errors\n" );
}
else
{
print ('Connecté') ;
}
-----------------------------------------code--------------------------------------------------------
Error received ;
Warning: Invalid argument supplied for foreach() in /var/www/sdb/9/7/shinj/php-client-54/Client.php on line 512
Problème lors de la connection ! errors=Error:
--------------------------------------code : Client.php#line 512 ----------------------------------
[...]
// Get operation data.
$opData = $this->_wsdl->getOperationData($this->_portName, $method);
if (PEAR::isError($opData)) {
$fault =& $this->_raiseSoapFault($opData);
return $fault;
}
$namespace = $opData['namespace'];
$this->__options['style'] = $opData['style'];
$this->__options['use'] = $opData['input']['use'];
$this->__options['soapaction'] = $opData['soapAction'];
// Set input parameters.
if ($this->__options['input'] == 'parse') {
$this->__options['parameters'] = $opData['parameters'];
$nparams = array();
if (isset($opData['input']['parts']) &&
count($opData['input']['parts'])) {
$i = 0;
foreach ($opData['input']['parts'] as $name => $part) { //line 512
$xmlns = '';
$attrs = array();
// [...]
----------------------------------------/code---------------------------------------------------------------------
if i ask a print_r ($opData) it shows :
Array ( [soapAction] => [style] => document
[input] => Array ( [parts] => Aarameters
[use] => literal
[message] => loginRequest
[namespace] => tns )
[output] => Array ( [use] => literal
[message] => loginResponse
[namespace] => tns
[parts] => Array ( [result] => Array ( [name] => result
[type] => LoginResult
[namespace] => tns ) ) )
[fault] => Array ( [name] => UnexpectedErrorFault
[use] => literal )
[parameters] => 1
[namespace] => urn:partner.soap.sforce.com ) ;
Is someone has an idea ....
thanks
Message Edited by statho on 04-12-2006 07:04 AM
Is [inputs][parts] an array? It doesn't look like it. foreach expects an array as its first parameter.