static void got_response (SoupSession *session, SoupMessage *msg, gpointer user_data) { GHashTable *hash; GError *error = NULL; if (!SOUP_STATUS_IS_SUCCESSFUL (msg->status_code)) { fprintf (stderr, "%d %s\n", msg->status_code, msg->reason_phrase); exit (1); } if (!soup_xmlrpc_extract_method_response (msg->response_body->data, msg->response_body->length, &error, G_TYPE_HASH_TABLE, &hash)) { if (!error) { fprintf (stderr, "Could not parse XMLRPC response:\n%d %s\n\n", msg->status_code, msg->reason_phrase); fprintf (stderr, "%s\n", msg->response_body->data); } else { fprintf (stderr, "XML-RPC error: %d %s", error->code, error->message); } exit (1); } g_hash_table_foreach (hash, print_struct_field, NULL); g_hash_table_destroy (hash); g_main_loop_quit (loop); }
static void xmlrpc_response_get_array(SoupSession *s, SoupMessage *m, gpointer user_data) { if (SOUP_STATUS_IS_SUCCESSFUL(m->status_code)) { soup_xmlrpc_extract_method_response(m->response_body->data, m->response_body->length, NULL, G_TYPE_VALUE_ARRAY, user_data); } g_main_quit(loop); lock = FALSE; }
static void xmlrpc_response_get_integer(SoupSession *s, SoupMessage *m, gpointer user_data) { gint *response = user_data; *response = -1; if (SOUP_STATUS_IS_SUCCESSFUL(m->status_code)) { soup_xmlrpc_extract_method_response(m->response_body->data, m->response_body->length, NULL, G_TYPE_INT, response); } g_main_quit(loop); lock = FALSE; }
static gchar *_soup_get_xmlrpc_value_string(SoupMessage * msg, SyncNetAction * sna) { gchar *string = NULL; sna->error = NULL; if (!SOUP_STATUS_IS_SUCCESSFUL(msg->status_code)) { SNA_ERROR(1, "%s (error #%d)", msg->reason_phrase, msg->status_code); goto bad; } if (!soup_xmlrpc_extract_method_response(msg->response_body->data, msg->response_body->length, NULL, G_TYPE_STRING, &string)) { SNA_ERROR(2, "Could not parse XML-RPC response"); } bad: return string; }