Looking at that PHP code I have no idea what format/type the actual PHP array is. Look in Reflector to determine the type of array and then use CreateArray() to create an array of the that type.
It looks like a collection, but that's not native in SOAP's xsd so it must be mapping to something else.
Rick,
I'm uncertain as to how the ComArray class would create an array object that I pass to the Call method (as it's 3rd parameter). Should I be creating an instance using System.Object, and passing the array items to that first?
Also, I don't know if the array I need to create is one-dimensional (as I don't know php that well). This is what the sample code of the array looks like in php:
$params = array(array('giftvoucher_id'=>array('lt'=>39), 'status'=>array('eq'=>'2')), 'balance'=>array('gteq'=>11.12), 'gift_code'=>array('like'=>'GIFT%'));
Can you clue me in to how to convert these same items (from the php above) into an array object, such as loItems... and then I can pass it to the call method as such:
loProxy.call(lSID,"giftcard.list", loItems)
Thanks,
Al
You can use the ComArray class to create and manipulate arrays:
http://www.west-wind.com/wsdlgenerator/docs?page=_3m90jxxxm.htm
+++ Rick ---
I'm trying to convert this sample php code into VFP code for a Magento soap request:
$client = new SoapClient(
'http://example.com/api/soap/?wsdl');
$params =
array(
array(
'giftvoucher_id'=>
array(
'lt'=>39),
'status'=>
array(
'eq'=>
'2')),
'balance'=>
array(
'gteq'=>11.12),
'gift_code'=>
array(
'like'=>
'GIFT%') );
$
session = $client->login(
'apiUser',
'apiKey');
$result = $client->
call($
session,
'giftcard.list', $params);
$client->endSession($
session);
key for above:
'lt' = '<'
'eq' = '='
'gteq' = '>='
Then the request returns this:
array(2) { [0] => array(22) { ["giftvoucher_id"] => string(2) "36"["gift_code"] => string(2) "ee"["balance"] => string(7) "12.0000"["currency"] => string(3) "USD"["status"] => string(1) "2"["expired_at"] => NULL["customer_id"] => string(1) "0"["customer_name"] => string(0) ""["customer_email"] => string(0) ""["recipient_name"] => string(0) ""["recipient_email"] => string(0) ""["recipient_address"] => NULL["message"] => NULL["store_id"] => string(1) "0"["conditions_serialized"] => string(168) "a:6:{s:4:"type";s:32:"salesrule/rule_condition_combine";s:9:"attribute";N;s:8:"operator";N;s:5:"value";s:1:"1";s:18:"is_value_processed";N;s:10:"aggregator";s:3:"all";}"["day_to_send"] => NULL["is_sent"] => string(1) "0"["shipped_to_customer"] => string(1) "0"["created_form"] => NULL["template_id"] => string(1) "1"["description"] => NULL["giftvoucher_comments"] => NULL
} [1] => array(22) { ["giftvoucher_id"] => string(2) "38"["gift_code"] => string(16) "GIFT-MEOA-DBGHW6"["balance"] => string(7) "12.0000"["currency"] => string(3) "USD"["status"] => string(1) "2"["expired_at"] => NULL["customer_id"] => string(1) "0"["customer_name"] => string(0) ""["customer_email"] => string(0) ""["recipient_name"] => string(0) ""["recipient_email"] => string(0) ""["recipient_address"] => NULL["message"] => NULL["store_id"] => string(1) "0"["conditions_serialized"] => string(168) "a:6:{s:4:"type";s:32:"salesrule/rule_condition_combine";s:9:"attribute";N;s:8:"operator";N;s:5:"value";s:1:"1";s:18:"is_value_processed";N;s:10:"aggregator";s:3:"all";}"["day_to_send"] => NULL["is_sent"] => string(1) "0"["shipped_to_customer"] => string(1) "0"["created_form"] => NULL["template_id"] => string(1) "1"["description"] => NULL["giftvoucher_comments"] => NULL
} }
I've gotten only to the point of creating a session id, but I'm not sure how to pass the parameters need above into an array within the call:
loProxy.call(lSID,"giftcard.list", ???)
Can you please help me with the correct code to send this call, and to loop through the result returned?
Thanks,
Al