You need to sign in to do that
Don't have an account?
coling
Missing certain fields in query results - using PHP Toolkit 11 with Enterprise wsdl
Hi again,
I am sure the answer to this is simple - I just can't see it.
I am using PHP Toolkit 11.0 with Enterprise wsdl. When I run a query (on a custom object), PHP does not get all of the result fields, even though all requested fields are being returned in the SOAP response. I cleared the wsdl cache before running this.
Here is a code snippet, a PHP dump of the result, and the SOAP parts. The missing field is Client_Timezone__c.
Code snippet re query:
function getMCMClientProfile($wc='') {
global $sf_connection;
$query = "Select Id, Name, Client_Phone_Number__c, Reject_Calls_From__c, Client_Timezone__c, ...(other fields)
from MCM_Client__c " . $wc;
try {
$queryOptions = new QueryOptions(50);
$response = $sf_connection->query(($query), $queryOptions);
$p_response = print_r($response, true);
echo "getMCMClientProfile: response=$p_response\n"; // A
$last_request = $sf_connection->getLastRequest();
echo "getMCMClientProfile: last_request=$last_request\n"; // B
$last_request_hdrs = $sf_connection->getLastRequestHeaders();
echo "getMCMClientProfile: last_request_hdrs=$last_request_hdrs\n"; // C
$last_response = $sf_connection->getLastResponse();
echo "getMCMClientProfile: last_response=$last_response\n"; // D
...
A: --- PHP Dump: Client_Timezone__c is missing
getMCMClientProfile: response=stdClass Object
(
[done] => 1
[queryLocator] =>
[records] => Array
(
[0] => stdClass Object
(
[Id] => a0670000002FZVdAAO
[Client_Phone_Number__c] => 914 555-1212
[Name] => Market Arch
[Reject_Calls_From__c] => Alabama;Hawaii
...(other fields) <----------- Client_Timezone__c is missing
)
)
[size] => 1
)
B: last_request
getMCMClientProfile: last_request=<?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>461700D70000000K7PB!ARMAQEciKYNI24gPu2kL09V3cgtt8s7w3GDUKftmZN6f4CjNMsf5IlFHzoGQhULQbgrwijdzDnmwgwpBghWktndP9cgXmW2q</ns1:sessionId></ns1:SessionHeader></SOAP-ENV:Header><SOAP-ENV:Body><ns1:query><ns1:queryString>Select Id, Name, Client_Phone_Number__c, Reject_Calls_From__c, Client_Timezone__c,
...(other fields)
from MCM_Client__c where Id = 'a0670000002FZVdAAO'</ns1:queryString></ns1:query></SOAP-ENV:Body></SOAP-ENV:Envelope>
C: last_request_hdrs
getMCMClientProfile: last_request_hdrs=POST /services/Soap/c/12.0/461700D70000000K7PB HTTP/1.1
Host: na5-api.salesforce.com
Connection: Keep-Alive
User-Agent: PHP-SOAP/5.2.0
Accept-Encoding: gzip, deflate
Content-Type: text/xml; charset=utf-8
SOAPAction: ""
Content-Length: 1083
D: -- last_response: Note that Client_Timezone__c is present
getMCMClientProfile: last_response=<?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:MCM_Client__c">
<sf:Id>a0670000002FZVdAAO</sf:Id>
<sf:Client_Phone_Number__c>914 555-1212</sf:Client_Phone_Number__c>
<sf:Client_Timezone__c>(GMT-05:00) Eastern Standard Time (America/New_York)</sf:Client_Timezone__c>
<sf:Name>Sample Name</sf:Name>
<sf:Reject_Calls_From__c>Alabama;Hawaii</sf:Reject_Calls_From__c>
...
</records>
<size>1</size>
</result>
</queryResponse>
</soapenv:Body>
</soapenv:Envelope>
Why does Client_Timezone__c get lost on the way to PHP??? Can anyone help?
Any comments or pointers are very much appreciated.
Colin Goldberg
I am sure the answer to this is simple - I just can't see it.
I am using PHP Toolkit 11.0 with Enterprise wsdl. When I run a query (on a custom object), PHP does not get all of the result fields, even though all requested fields are being returned in the SOAP response. I cleared the wsdl cache before running this.
Here is a code snippet, a PHP dump of the result, and the SOAP parts. The missing field is Client_Timezone__c.
Code snippet re query:
function getMCMClientProfile($wc='') {
global $sf_connection;
$query = "Select Id, Name, Client_Phone_Number__c, Reject_Calls_From__c, Client_Timezone__c, ...(other fields)
from MCM_Client__c " . $wc;
try {
$queryOptions = new QueryOptions(50);
$response = $sf_connection->query(($query), $queryOptions);
$p_response = print_r($response, true);
echo "getMCMClientProfile: response=$p_response\n"; // A
$last_request = $sf_connection->getLastRequest();
echo "getMCMClientProfile: last_request=$last_request\n"; // B
$last_request_hdrs = $sf_connection->getLastRequestHeaders();
echo "getMCMClientProfile: last_request_hdrs=$last_request_hdrs\n"; // C
$last_response = $sf_connection->getLastResponse();
echo "getMCMClientProfile: last_response=$last_response\n"; // D
...
A: --- PHP Dump: Client_Timezone__c is missing
getMCMClientProfile: response=stdClass Object
(
[done] => 1
[queryLocator] =>
[records] => Array
(
[0] => stdClass Object
(
[Id] => a0670000002FZVdAAO
[Client_Phone_Number__c] => 914 555-1212
[Name] => Market Arch
[Reject_Calls_From__c] => Alabama;Hawaii
...(other fields) <----------- Client_Timezone__c is missing
)
)
[size] => 1
)
B: last_request
getMCMClientProfile: last_request=<?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>461700D70000000K7PB!ARMAQEciKYNI24gPu2kL09V3cgtt8s7w3GDUKftmZN6f4CjNMsf5IlFHzoGQhULQbgrwijdzDnmwgwpBghWktndP9cgXmW2q</ns1:sessionId></ns1:SessionHeader></SOAP-ENV:Header><SOAP-ENV:Body><ns1:query><ns1:queryString>Select Id, Name, Client_Phone_Number__c, Reject_Calls_From__c, Client_Timezone__c,
...(other fields)
from MCM_Client__c where Id = 'a0670000002FZVdAAO'</ns1:queryString></ns1:query></SOAP-ENV:Body></SOAP-ENV:Envelope>
C: last_request_hdrs
getMCMClientProfile: last_request_hdrs=POST /services/Soap/c/12.0/461700D70000000K7PB HTTP/1.1
Host: na5-api.salesforce.com
Connection: Keep-Alive
User-Agent: PHP-SOAP/5.2.0
Accept-Encoding: gzip, deflate
Content-Type: text/xml; charset=utf-8
SOAPAction: ""
Content-Length: 1083
D: -- last_response: Note that Client_Timezone__c is present
getMCMClientProfile: last_response=<?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:MCM_Client__c">
<sf:Id>a0670000002FZVdAAO</sf:Id>
<sf:Client_Phone_Number__c>914 555-1212</sf:Client_Phone_Number__c>
<sf:Client_Timezone__c>(GMT-05:00) Eastern Standard Time (America/New_York)</sf:Client_Timezone__c>
<sf:Name>Sample Name</sf:Name>
<sf:Reject_Calls_From__c>Alabama;Hawaii</sf:Reject_Calls_From__c>
...
</records>
<size>1</size>
</result>
</queryResponse>
</soapenv:Body>
</soapenv:Envelope>
Why does Client_Timezone__c get lost on the way to PHP??? Can anyone help?
Any comments or pointers are very much appreciated.
Colin Goldberg
On a different topic, the usage of QueryOption is different now in the v11 of the toolkit. Please see the QueryOptions sample on this wiki page: http://wiki.apexdevnet.com/index.php/PHP_Toolkit_11.0_Samples