Closed GoogleCodeExporter closed 8 years ago
The object should implement IXMLRPCStruct. I will re-visit this solution to see
if
there is a cleaner way of handling object serialization
Original comment by akeemphi...@gmail.com
on 23 Oct 2007 at 9:11
Would you mind adding a document with a simple example of implementing
IXMLRPCStruct?
I am hung up on this as well. It seems from flex that is the only way to pass an
associative array.
Original comment by sigil%ir...@gtempaccount.com
on 23 Oct 2007 at 10:54
In com.ak33m.rpc.xmlrpc.XMLRPCSerializer in encodeObject() I added the
following line
after if (tobject is IXMLRPCStruct) condition:
else if (tobject is IXMLRPCStruct)
{
txmllist = encodeStruct(tobject.getPropertyData());
}
else if (tobject is Object) // added by judah oct 23
{
txmllist = encodeStruct(tobject);
}
This seems to do work but I haven't tested it much. Akeem, does this look
alright?
Original comment by dorkiedo...@gmail.com
on 24 Oct 2007 at 12:31
I'd like to see an example implementing IXMLRPCStruct. I tried below and it is
not
serialized.
import com.ak33m.rpc.xmlrpc.IXMLRPCStruct;
[Bindable]
public dynamic class BlogEntry implements IXMLRPCStruct {
public function getPropertyData():* {
return this;
}
}
Original comment by dorkiedo...@gmail.com
on 25 Oct 2007 at 12:42
The encodeObject has a check for is String. Then we have the default condition
that
converts to a string if the type does not match any condition we have checked
for.
Maybe the default should be encode an object,
line 101:
else
{
//txmllist = encodeString(tobject as String);
txmllist = encodeStruct(tobject);
}
or if string returns "null" then attempt to encode as a struct.
Original comment by dorkiedo...@gmail.com
on 25 Oct 2007 at 9:31
The spec fro xmlrpc requires that the default option be string. I have not been
able
to test the solution outlined in comment 3 but is this no longer a viable
solution?
To use the IXMLRPCStruct your data object should implement IXMLRPCStruct and the
getPropertyData should return an object containing the properties that you
would like
serialized. The reason this was done is to facilitate serialization of strongly
typed
data objects.
Original comment by akeemphi...@gmail.com
on 26 Oct 2007 at 12:44
the code in comment 3 works for objects, but i quickly found that i was using
VO's.
as soon as i made my own class the condition did not match.
could you post a simple example of implementing the IXMLRPCStruct?
import com.ak33m.rpc.xmlrpc.IXMLRPCStruct;
[Bindable]
public dynamic class BlogEntry implements IXMLRPCStruct {
public var myInt:uint = 0;
public var myString:String = "";
public var myArray:Array = [];
public function getPropertyData():* {
return ; // what goes here
}
}
Original comment by dorkiedo...@gmail.com
on 26 Oct 2007 at 1:15
For your example that would be:
public dynamic class BlogEntry implements IXMLRPCStruct {
public var myInt:uint = 0;
public var myString:String = "";
public var myArray:Array = [];
public function getPropertyData():* {
return {myInt:this.myInt,myString:this.myString,myArray:this.myArray};
}
}
Original comment by akeemphi...@gmail.com
on 26 Oct 2007 at 4:07
Added dorkie's solution.
Original comment by akeemphi...@gmail.com
on 17 Apr 2008 at 3:48
dorkie's solution isn't all the way there.
i've created a patch which changes the for-loop in serialize() method and also
implements dorkie's object check
this seems to fully live up to the xmlrpc specs
Original comment by dhaarbrink@gmail.com
on 4 Jun 2008 at 4:12
Attachments:
Original issue reported on code.google.com by
dorkiedo...@gmail.com
on 23 Oct 2007 at 8:16