Skip to content
This repository has been archived by the owner on Jan 10, 2024. It is now read-only.

Query : Throw Exception SoapFault Object ( [message:protected] => Element {}item invalid at this location #50

Open
rakesh-mistry opened this issue Feb 5, 2016 · 3 comments

Comments

@rakesh-mistry
Copy link

I am using enterprise and able to login using mySforceConnection->login method. But when try to execute query using query mySforceConnection->query i got below exception.

SoapFault Object ( [message:protected] => Element {}item invalid at this location [string:Exception:private] => [code:protected] => 0 [file:protected] => /payment/soapclient/SforceBaseClient.php [line:protected] => 808 [trace:Exception:private] => Array ( [0] => Array ( [file] => /payment/soapclient/SforceBaseClient.php [line] => 808 [function] => __call [class] => SoapClient [type] => -> [args] => Array ( [0] => query [1] => Array ( [0] => Array ( [queryString] => Select Name, zqu__BillToContact__c, zqu__BillToContact__r.Email, Contact_Email__c From zqu__Quote__c ) ) ) ) [1] => Array ( [file] => /payment/soapclient/SforceBaseClient.php [line] => 808 [function] => query [class] => SforceSoapClient [type] => -> [args] => Array ( [0] => Array ( [queryString] => Select Name, zqu__BillToContact__c, zqu__BillToContact__r.Email, Contact_Email__c From zqu__Quote__c ) ) ) [2] => Array ( [file] => /payment/enterprise.php [line] => 24 [function] => query [class] => SforceBaseClient [type] => -> [args] => Array ( [0] => Select Name, zqu__BillToContact__c, zqu__BillToContact__r.Email, Contact_Email__c From zqu__Quote__c ) ) ) [previous:Exception:private] => [faultstring] => Element {}item invalid at this location [faultcode] => soapenv:Client )

@metadaddy
Copy link
Contributor

Can you post your code for the login and query?

@rakesh-mistry
Copy link
Author

Thanks for your quick reply. Here is my code.

define("SOAP_CLIENT_BASEDIR", "./soapclient");
$USERNAME='My User Name';
$PASSWORD="My Password ";
$SECURITY_TOKEN="Token Goes here";
require_once (SOAP_CLIENT_BASEDIR.'/SforcePartnerClient.php');
require_once (SOAP_CLIENT_BASEDIR.'/SforceHeaderOptions.php');

try {
    $mySforceConnection = new SforcePartnerClient();
    $mySoapClient = $mySforceConnection->createConnection(SOAP_CLIENT_BASEDIR.'/enterprise.wsdl.xml');
    $mylogin = $mySforceConnection->login($USERNAME, $PASSWORD.$SECURITY_TOKEN);
    print_r($mySforceConnection);
    echo "<hr>";
    $mySforceConnection->printDebugInfo();
    echo "<hr>";

    $query = 'Select Name, zqu__BillToContact__c, zqu__BillToContact__r.Email, Contact_Email__c From zqu__Quote__c';
    $response = $mySforceConnection->query($query);
    foreach ($response->records as $record) {
    print_r($record);
    print_r("<br>");
    }



} catch (Exception $e) {
    print_r($e);
    echo "<hr>";
}

@metadaddy
Copy link
Contributor

Check the API name of the 'Contact Email' field. Your other custom fields have the zqu__ prefix. I'm guessing your query should be

$query = 'Select Name, zqu__BillToContact__c, zqu__BillToContact__r.Email, zqu__Contact_Email__c From zqu__Quote__c';

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants