| Top |
char * soup_xmlrpc_build_method_call (const char *method_name,GValue *params,int n_params);
This creates an XML-RPC methodCall and returns it as a string.
This is the low-level method that soup_xmlrpc_request_new() is
built on.
params
is an array of GValue representing the parameters to
method
. (It is *not* a GValueArray, although if you have a
GValueArray, you can just pass its valuesf and
n_values fields.)
The correspondence between glib types and XML-RPC types is:
int: int (G_TYPE_INT)
boolean: gboolean (G_TYPE_BOOLEAN)
string: char* (G_TYPE_STRING)
double: double (G_TYPE_DOUBLE)
datetime.iso8601: SoupDate (SOUP_TYPE_DATE)
base64: GByteArray (SOUP_TYPE_BYTE_ARRAY)
struct: GHashTable (G_TYPE_HASH_TABLE)
array: GValueArray (G_TYPE_VALUE_ARRAY)
For structs, use a GHashTable that maps strings to GValue;
soup_value_hash_new() and related methods can help with this.
SoupMessage * soup_xmlrpc_request_new (const char *uri,const char *method_name,...);
Creates an XML-RPC methodCall and returns a SoupMessage, ready to send, for that method call.
The parameters are passed as type/value pairs; ie, first a GType,
and then a value of the appropriate type, finally terminated by
G_TYPE_INVALID.
gboolean soup_xmlrpc_parse_method_response (const char *method_response,int length,GValue *value,GError **error);
Parses method_response
and returns the return value in value
. If
method_response
is a fault, value
will be unchanged, and error
will be set to an error of type SOUP_XMLRPC_FAULT, with the error
code containing the fault code, and the error message containing
the fault string. (If method_response
cannot be parsed at all,
soup_xmlrpc_parse_method_response() will return FALSE, but error
will be unset.)
gboolean soup_xmlrpc_extract_method_response (const char *method_response,int length,GError **error,GType type,...);
Parses method_response
and extracts the return value into
a variable of the correct type.
If method_response
is a fault, the return value will be unset,
and error
will be set to an error of type SOUP_XMLRPC_FAULT, with
the error code containing the fault code, and the error message
containing the fault string. (If method_response
cannot be parsed
at all, soup_xmlrpc_extract_method_response() will return FALSE,
but error
will be unset.)
gboolean soup_xmlrpc_parse_method_call (const char *method_call,int length,char **method_name,GValueArray **params);
Parses method_call
to get the name and parameters, and returns the
parameter values in a GValueArray; see also
soup_xmlrpc_extract_method_call(), which is more convenient if you
know in advance what the types of the parameters will be.
gboolean soup_xmlrpc_extract_method_call (const char *method_call,int length,char **method_name,...);
Parses method_call
to get the name and parameters, and puts
the parameters into variables of the appropriate types.
The parameters are handled similarly to
soup_xmlrpc_build_method_call
, with pairs of types and values,
terminated by G_TYPE_INVALID, except that values are pointers to
variables of the indicated type, rather than values of the type.
See also soup_xmlrpc_parse_method_call(), which can be used if
you don't know the types of the parameters.
char *
soup_xmlrpc_build_method_response (GValue *value);
This creates a (successful) XML-RPC methodResponse and returns it
as a string. To create a fault response, use
soup_xmlrpc_build_fault().
The glib type to XML-RPC type mapping is as with
soup_xmlrpc_build_method_call(), qv.
char * soup_xmlrpc_build_fault (int fault_code,const char *fault_format,...);
This creates an XML-RPC fault response and returns it as a string.
(To create a successful response, use
soup_xmlrpc_build_method_response().)
void soup_xmlrpc_set_response (SoupMessage *msg,GType type,...);
Sets the status code and response body of msg
to indicate a
successful XML-RPC call, with a return value given by type
and the
following varargs argument, of the type indicated by type
.
void soup_xmlrpc_set_fault (SoupMessage *msg,int fault_code,const char *fault_format,...);
Sets the status code and response body of msg
to indicate an
unsuccessful XML-RPC call, with the error described by fault_code
and fault_format
.
#define SOUP_XMLRPC_FAULT soup_xmlrpc_fault_quark()
A GError domain representing an XML-RPC fault code. Used with SoupXMLRPCFault (although servers may also return fault codes not in that enumeration).
Pre-defined XML-RPC fault codes from http://xmlrpc-epi.sourceforge.net/specs/rfc.fault_codes.php. These are an extension, not part of the XML-RPC spec; you can't assume servers will use them.