+ Start a Discussion

PHP SOAP toolkit using partner WSDL does not return fields when running a query

Hello. I'm using the PHP SOAP toolkit with the partner api and I'm getting a strange response when running a query operation. I've been a long time user of the Enterprise WSDL and have not had any problems. Here is the simple query I'm running:


$result = $client->query("SELECT Id, Email, FirstName FROM Contact WHERE email in ('john.doe@example.com') ");

 And here is my result:


QueryResult Object
    [queryLocator] => 
    [done] => 1
    [records] => Array
            [0] => stdClass Object
                    [type] => Contact
                    [Id] => Array
                            [0] => 003G00000166xcxIAA
                            [1] => 003G00000166xcxIAA

                    [any] => john.doe@example.comJohn


    [size] => 1
    [pointer] => 0
    [sf:QueryResult:private] => SforcePartnerClient Object

 Does anyone know what is causing this? According to the samples the returned object should look something like this:


    [0] => SObject Object
            [type] => Account
            [fields] => stdClass Object
                    [AccountNumber] => 12324312
                    [Name] => XYZ Account
                    [Website] => www.somewebsite.co.uk

            [Id] => 0018000000Ll0VmAAJ

 Any thoughts would be appreciated.



I'm getting the same thing.  What is the "ANY" array?


Also, why is Id an array of size 2 with the exact same values?


Can someone from salesforce please respond to this post.  I'm stuck here...


About the array of 2 Ids:

By design (see the wsdl), you will get 1 or 2 Ids, that's why in this example you get an array of 2. I tried to raise this point as a defect but Sfdc answered it was by design, not a bug.


Ok. But that still doesn't make any sense. The partner WSDL defines the sObject type as having an Id element. It doesn't have a minOccurs or maxOccurs attribute so that means there should only be 1.


This works as advertised in older versions. The response from this call is pretty worthless. I did a diff between the older version and there used to be some partner api specific classes that are used for these responses. This code was moved into the SFBaseClient and supposedly tries to work for both enterprise and partner api.


Who is the official maintainer of this toolkit anyway?


pcave_jacksonriver wrote:

Who is the official maintainer of this toolkit anyway?

Initially, the toolkit was developed by adamcgrossbenjasikchipskidcarroll_sforcedchasmankhouseknechtron_hessryankicks,stevebuiktranmanyovnehess2


Latest updates have been commited by Dave Caroll, Pat Patterson, and burnabitPV