On Mon, Sep 22, 2008 at 10:27 PM, Coe, Colin C. (Unix Engineer)
<[EMAIL PROTECTED]> wrote:
>
> Hi all
>
> I'm currently trying to implement 'system.profile.getCustomOptions' (and
> 'system.profile.setCustomOptions' but I haven't started that one yet).
> The problem I have is in the data I'm getting back.
>
> My Perl test code is basically just:
> ---
> my $retval = $client->call('system.profile.getCustomOptions', $session,
> $ARGV[0]);
> print Dumper $retval;
> ---
>
> And the data I'm getting back is
> ---
> $VAR1 = [
> {
> 'value' =>
> '[EMAIL PROTECTED],argume
> nts=blah
> ]'
> },
> {
> 'value' =>
> '[EMAIL PROTECTED],argume
> nts=blahblah
> ]'
> <<SystemProfileHandler.java>> }
> ];
> ---
>
> I think what I want is a array of hashes, something like:
> ---
> $VAR1 = [
> {
> 'id' => '139',
> 'arguments' => 'blah'
> ]'
> },
> {
> 'id' => '140',
> 'arguments' => 'blahblah'
> ]'
> }
> ];
> ---
>
> The .java file is attached.
>
> Could someone point me in the right direction?
The objects are not being serialized correctly. Whenever you return
an object from the API there needs to be a valid serializer for that
class. Casting a SortedSet as an Object is incorrect. A SortedSet is
effectively a sorted List without duplicates, so what you should
return is a List, it might require transformation of the SortedSet
into a List. You will also need a Serializer for each of the class
object types within the List. For example,if the List contains
KickstartCommands, you need a custom serializer for those.
The way Serializers work is they are registered at startup with the
XmlRpcServer for a given Class. When the serialization occurs, it
looks up the class being returned and looks for a matching serializer,
the serializers then call other serializers for the classes they do
not know how to handle. It continues down this path until the entire
object graph has been properly serialized or until a serializer deems
itself as the final one and no longer passes the data to any other
serializers.
In short, you need to create a custom serializer :)
jesus
_______________________________________________
Spacewalk-devel mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/spacewalk-devel