PHP repeated elements in a soap call

Prude

New Member
I am having a problem with a soap call I'm trying to do from PHP.First some background information: The call is going to a system that does a person search on a big CRM system. It requires information like name, city, birthdate, etc. ) When successful, it should return one or multiple id's. The soap interface is a standard piece of the system, so I can not influence the layout of the call.I first started off by building the soap request in SoapUI, to see if I could get it working. I ended up with this soap request, which is working:\[code\] <soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:hidl="http://humaninference.com/hidl-mapped"> <soap:Header/> <soap:Body> <hidl:HI__DQComponents__Identify__Searching__Search> <hidl:model>MAGMA::PERSON</hidl:model> <hidl:execution>Match</hidl:execution> <hidl:interfaceFields> <hidl:item> <hidl:Name>master_id</hidl:Name> <hidl:Value>0</hidl:Value> </hidl:item> <hidl:item> <hidl:Name>Name</hidl:Name> <hidl:Value>jansen</hidl:Value> </hidl:item> <hidl:item> <hidl:Name>birthdate</hidl:Name> <hidl:Value></hidl:Value> </hidl:item> <hidl:item> <hidl:Name>add_id</hidl:Name> <hidl:Value></hidl:Value> </hidl:item> <hidl:item> <hidl:Name>street</hidl:Name> <hidl:Value>oudegracht</hidl:Value> </hidl:item> <hidl:item> <hidl:Name>dumstreet</hidl:Name> <hidl:Value></hidl:Value> </hidl:item> <hidl:item> <hidl:Name>housenumber</hidl:Name> <hidl:Value></hidl:Value> </hidl:item> <hidl:item> <hidl:Name>postcode</hidl:Name> <hidl:Value></hidl:Value> </hidl:item> <hidl:item> <hidl:Name>city</hidl:Name> <hidl:Value>Utrecht</hidl:Value> </hidl:item> <hidl:item> <hidl:Name>citydum</hidl:Name> <hidl:Value></hidl:Value> </hidl:item> <hidl:item> <hidl:Name>add_line_twee</hidl:Name> <hidl:Value></hidl:Value> </hidl:item> </hidl:interfaceFields> </hidl:HI__DQComponents__Identify__Searching__Search> </soap:Body></soap:Envelope>\[/code\]The next step was to build the same request from PHP, for that I wrote this piece of code:\[code\]$result = $client->HI__DQComponents__Identify__Searching__Search(array( 'model' => 'MAGMA::PERSON', 'execution' => 'Search', 'interfaceFields' => array ( 'item' => array ('Name' => 'master_id', 'Value' => '0' ), 'item' => array ('Name' => 'Name', 'Value' => 'jansen' ), 'item' => array ('Name' => 'birthdate', 'Value' => ' ' ), 'item' => array ('Name' => 'add_id', 'Value' => ' ' ), 'item' => array ('Name' => 'street', 'Value' => 'Oudegracht' ), 'item' => array ('Name' => 'dumstreet', 'Value' => ' ' ), 'item' => array ('Name' => 'housenumber', 'Value' => ' ' ), 'item' => array ('Name' => 'postcode', 'Value' => ' ' ), 'item' => array ('Name' => 'city', 'Value' => 'utrecht' ), 'item' => array ('Name' => 'citydum', 'Value' => ' ' ), 'item' => array ('Name' => 'add_line_twee', 'Value' => ' ' ), ) ));echo '<PRE>';print_r($result);echo '</PRE>';\[/code\]This however fails. The problem is pretty obvious, since the "item" element is repeated several times, and in PHP it is the key of the array, only the Item add_line_twee will be in the array called "interfaceFields", since it's overwritten all the time.Unfortunately I can't figure out how to do this another way around, so I can't get the request to be like in the example I created from SoapUI.Any ideas?
 
Back
Top