Re: Use of XML-RPC methods



On 08/31/2010 05:56 AM, Phil Daintree wrote:
> I am trying to use libsoup's XML-RPC client methods to get data from a
> remote application .. using genie (or vala). Using the code

>     try
>         xmlrpc_parse_method_response (ResponseData, MessageLength,
> typeof(int))
>         print("Stock of %s = %s",ItemCode, ResponseData)
>     except
>         print("Could not get webERP API location stock over XML-RPC.")

So, I don't know how the XML-RPC API ends up being wrapped in Vala, but
that "typeof(int)" makes me think the answer is "incorrectly". In the C
API, there's a GValue parameter there, and the response value gets
stored into it, so the code would look something like:

    GValue val;
    GValueArray *array;

    g_value_init (&val, G_TYPE_VALUE_ARRAY);
    soup_xmlrpc_parse_method_response (data, length, &val, &error);
    array = g_value_dup_boxed (&val);
    g_value_unset (&val);

I'm not sure how that would translate into Vala.

soup_xmlrpc_extract_method_response() is a convenience API that hides
the use of GValue, but that almost certainly won't work correctly from Vala.

At some point I'm planning to redo the XML-RPC API in terms of GVariant,
which ought to hopefully make it easier and more understandable from
language bindings. But I don't know when that will happen.

For now, your best bet is probably to ask on a vala mailing list.

-- Dan


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]