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
colingcoling 

Not getting all query fields from custom object - Enterprise wsdl v12.0 - PHP Toolkit 11.0

Hi There,

I must be tired.

Using the new PHP Toolkit (11.0) and Enterprise wsdl API v 12.0, I am only getting the Id field in the result.

Code snippet:
...
$get_query_fields = getSFQueryFields('Toll_Free_Number__c');
echo "query_fields=$get_query_fields\n";
$query = "SELECT $get_query_fields from Toll_Free_Number__c where Name='$phone_number'";
try {
  $queryOptions = new QueryOptions(50);
  $response = $sf_connection->query(($query), $queryOptions);
  $p_response = print_r($response, true);
  echo "response=$p_response\n";
  ...
}
...

Result:
query_fields=Id, IsDeleted, Name, CreatedDate, CreatedById, LastModifiedDate, LastModifiedById, SystemModstamp, LastActivityDate, Campaign__c
response=stdClass Object
(
    [done] => 1
    [queryLocator] =>
    [records] => Array
        (
            [0] => stdClass Object
                (
                    [Id] => a0870000001NxOZAA0
                )

        )

    [size] => 1
)

It should be obvious to me but it isn't. What am I doing wrong?

Colin G


colingcoling
After a good night's sleep, I have discovered the frustrations of the wsdl cache - a previous version of enterprise.wsdl.xml contained a binding to version 10.0 instead of version 12.0
ie. as in:
<!-- Soap Service Endpoint -->
    <service name="SforceService">
        <documentation>Sforce SOAP API</documentation>
        <port binding="tns:SoapBinding" name="Soap">
            <soap:address location="https://www.salesforce.com/services/Soap/c/12.0"/>
        </port>
    </service>

As soon as I removed the wsdl cache file (/tmp/wsdl-*), I was able to retrieve all the query fields.

As an aside: Even though I received no responses from my initial post, I do seriously value this forum. It enabled me to write down my thoughts, and in doing so I was (luckily this time) able to methodically solve my problem.

Colin Goldberg



Tran ManTran Man
Glad you figured it out.  The actual problem is that PHP caches the WSDL.  You can get around it by turning it off: 

See this wiki page:
http://wiki.apexdevnet.com/index.php/Turning_off_WSDL_cache
colingcoling
Hi again,

Perhaps this should be a different thread, but it is related, so here it is:

I have a query requesting a rollup summary field from a custom object - which is not being returned in the response, even though the field is being sent in the response xml.

Here are the lastRequest and lastResponse strings. The field in question is Call_Log_Count__c.

lastRequest:
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="urn:enterprise.soap.sforce.com">
<SOAP-ENV:Header><ns1:SessionHeader><ns1:sessionId>461300D70000...</ns1:sessionId></ns1:SessionHeader></SOAP-ENV:Header>
<SOAP-ENV:Body>
<ns1:query><ns1:queryString>Select Id, Default_Client__c, Name, Start_Date__c, End_Date__c, Last_Client_Used__c, Call_Log_Count__c from Campaign__c  where Id = 'a0770000002S0jTAAS'</ns1:queryString></ns1:query>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>

lastResponse:
<?xml version="1.0" encoding="UTF-8"?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns="urn:enterprise.soap.sforce.com" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:sf="urn:sobject.enterprise.soap.sforce.com">
<soapenv:Body>
<queryResponse>
<result>
<done>true</done>
<queryLocator xsi:nil="true"/>
<records xsi:type="sf:Campaign__c"><sf:Id>a0770000002S0jTAAS</sf:Id><sf:Call_Log_Count__c>0.0</sf:Call_Log_Count__c><sf:Default_Client__c>a0670000002FZVdAAO</sf:Default_Client__c><sf:End_Date__c>2008-03-21</sf:End_Date__c><sf:Name>test data</sf:Name><sf:Start_Date__c>2008-02-27</sf:Start_Date__c></records>
<size>1</size>
</result>
</queryResponse>
</soapenv:Body>
</soapenv:Envelope>

As you can see, Call_Log_Count__c is included.

And the returned response:
stdClass Object
(
    [Id] => a0770000002S0jTAAS
    [Default_Client__c] => a0670000002FZVdAAO
    [End_Date__c] => 2008-03-21
    [Name] => test data
    [Start_Date__c] => 2008-02-27
)

Where did Call_Log_Count__c go?

Can anyone help?

Colin Goldberg