Max Occurs in SOAP API


(Sean O'hAodha) #1

Hi,

 

I'm using the SOAP API (http://manuals.matrix.squizsuite.net/web-services/chapters/soap-api-search-service)

 

How do I pass more than one value for a parameter in PHP when using the SOAP API? For example the Basic Search SOAP API can take multiple values for Statuses. I'm using

$basicSearch = Array (

...

'Limit' => '100000'

'Statuses' => '4', 'Statuses' => '8',
'Statuses' => '16',

'RootIDs' => '3232',

...

);

 

but it will only pass

...<Limit>100000</Limit><Statuses>16</Statuses><RootIDs>3232</RootIDs>...

 

It seems to only take the last value I have passed for Statuses.

 

I also tried passing the values in an array like

'Statuses' => Array('4','8','16') but not good either.

 

Anyone know how to do this? Thanks.

 


(Nic Hubbard) #2

What are you using to get your Array into XML?


(Sean O&#39;hAodha) #3

$client = new SoapClient($soapPath, array(                                                    'login'       => "xxx",
                                                   'password'    => "xxx",
                                                   'trace'      => 1,
                                                   'exceptions' => 0));

 

$basicSearch = Array (
            'AssetTypes' => Array (
                'AssetType' => 'page',
                'Inherit' => '1'
                ),
            'Limit' => '100000',
            'Statuses' => '4',
            'Statuses' => '8',
            'Statuses' => '16',
            'Statuses' => '32',
            'Statuses' => '64',
            'Statuses' => '128',
            'Statuses' => '256',
            'RootIDs' => '24752',
            'ExcludeRootNodes' => 'FALSE',
            'ResultFormat' => '%asset_assetid%,%asset_url%'
            );

    $results = (Array)$client->BasicSearch($basicSearch);


(Benjamin Pearson) #4

This works for me (using the code above with config changes):

'Statuses' => Array('4','8','16')

It produces:

<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://www.example.com/_web_services/soap">
<SOAP-ENV:Body>
 <ns1:BasicSearch>
  <AssetTypes>
    <AssetType>page</AssetType>
     <Inherit>1</Inherit>
  </AssetTypes>
  <Limit>100000</Limit>
  <Statuses>4</Statuses>
  <Statuses>8</Statuses>
  <Statuses>16</Statuses>
  <RootIDs>72</RootIDs>
  <ExcludeRootNodes>true</ExcludeRootNodes>
  <ResultFormat>%asset_assetid%,%asset_url%</ResultFormat>
 </ns1:BasicSearch>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>

(Sean O&#39;hAodha) #5

:rolleyes: I don't know what I was doing when I tried putting them in the array before but that works for me now. Thanks for your help guys!