Complex Args
"Andrew" <[email protected]> Fri, 15 Feb 2008 21:46:43 -0000
| Newsgroups | gmane.text.xml.rpc.specification |
|---|---|
| Message-ID | <[email protected]> |
I am trying to create an complex struct with multiple arrays
This is an example of my array setup before creating the struct
$args=Array
(
[authentication] => Array
(
[username] => xxxxx
[password] => yyyyy
)
[default] => Array
(
[id_panel] => 1
)
[command] => Array
(
[panelist] => Array
(
[id_panelist] => 11111
[panelist_status] => 22222
[DATE_CONFIRMED] => 33333
)
)
)
I am using the following code to produce my struct
$myValue=new XML_RPC_Value();
$tmpStruct=array();
foreach($args as $key=>$value) {
$temp=array();
foreach($value as $key2=>$value2) {
if(is_array($value2)) {
$temp2=array();
foreach($value2 as $key3=>$value3) {
$temp2[$key3]=new XML_RPC_value($value3);
}
$temp[$key2]=new XML_RPC_value($temp2,'struct');
} else {
$temp[$key2]=new XML_RPC_value($value2);
}
}
$tmpStruct[$key]=new XML_RPC_value($temp,'struct');
}
This code is producing the following
XML_RPC_Value Object
(
[me] => Array
(
[struct] => XML_RPC_Value Object
(
[me] => Array
(
[struct] => Array
(
[authentication] => XML_RPC_Value
Object
(
[me] => Array
(
[struct] => Array
(
[username]
=> XML_RPC_Value Object
(
[me]
=> Array
(
[string] => xxxxx
)
[mytype] => 1
)
[password]
=> XML_RPC_Value Object
(
[me]
=> Array
(
[string] => yyyyy
)
[mytype] => 1
)
)
)
[mytype] => 3
)
[default] => XML_RPC_Value Object
(
[me] => Array
(
[struct] => Array
(
[id_panel]
=> XML_RPC_Value Object
(
[me]
=> Array
(
[string] => 1
)
[mytype] => 1
)
)
)
[mytype] => 3
)
[command] => XML_RPC_Value Object
(
[me] => Array
(
[struct] => Array
(
[panelist]
=> XML_RPC_Value Object
(
[me]
=> Array
(
[struct] => Array
(
[id_panelist] => XML_RPC_Value Object
(
[me] => Array
(
[string] => 11111
)
[mytype] => 1
)
[panelist_status] => XML_RPC_Value Object
(
[me] => Array
(
[string] => 22222
)
[mytype] => 1
)
[DATE_CONFIRMED] => XML_RPC_Value Object
(
[me] => Array
(
[string] => 33333
)
[mytype] => 1
)
)
)
[mytype] => 3
)
)
)
[mytype] => 3
)
)
)
[mytype] => 3
)
)
[mytype] => 3
)
The produced object is not being serialized properly when creating the
payload.
Can you please advise where my algorithm is lacking
Thank You
Andrew Payton
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/xml-rpc/
<*> Your email settings:
Individual Email | Traditional
<*> To change settings online go to:
http://groups.yahoo.com/group/xml-rpc/join
(Yahoo! ID required)
<*> To change settings via email:
mailto:[email protected]
mailto:[email protected]
<*> To unsubscribe from this group, send an email to:
[email protected]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/