int main (int argc, char **argv) { SoupSession *session; SoupURI *proxy = NULL; SoupMessage *msg; const char *uri = "http://bugzilla.redhat.com/bugzilla/xmlrpc.cgi"; int opt, bug; g_thread_init (NULL); g_type_init (); while ((opt = getopt (argc, argv, "p:")) != -1) { switch (opt) { case 'p': proxy = soup_uri_new (optarg); if (!proxy) { fprintf (stderr, "Could not parse %s as URI\n", optarg); exit (1); } break; case '?': usage (); break; } } argc -= optind; argv += optind; if (argc > 1) { uri = argv[0]; argc--; argv++; } if (argc != 1 || (bug = atoi (argv[0])) == 0) usage (); session = soup_session_async_new_with_options ( SOUP_SESSION_PROXY_URI, proxy, NULL); msg = soup_xmlrpc_request_new (uri, "bugzilla.getBug", G_TYPE_INT, bug, G_TYPE_INVALID); if (!msg) { fprintf (stderr, "Could not create web service request to '%s'\n", uri); exit (1); } soup_session_queue_message (session, SOUP_MESSAGE (msg), got_response, NULL); loop = g_main_loop_new (NULL, TRUE); g_main_loop_run (loop); g_main_loop_unref (loop); return 0; }
static gboolean _soup_xmlrpc_call(gchar * method, SyncNetAction * sna, SoupSessionCallback callback) { SoupMessage *msg; sna->error = NULL; msg = soup_xmlrpc_request_new(XMLRPC_SERVER_URI, method, G_TYPE_INVALID); if (!msg) return FALSE; DEBUG("calling xmlrpc method %s", method); soup_session_queue_message(session, msg, callback, sna); g_main_run(loop); return TRUE; }