sample.c
Go to the documentation of this file.
00001 #include <stdio.h>
00002 #include <xmlrpc-c/client.h>
00003 
00004 int main(int const argc, const char ** const argv) {
00005     xmlrpc_env env;
00006     xmlrpc_value * resultP;
00007     int sum;
00008     char * const url = "http://xmlrpc-c.sourceforge.net/api/sample.php";
00009     char * const methodName = "sample.add";
00010 
00011     /* Initialize our error-handling environment. */
00012     xmlrpc_env_init(&env);
00013     /* Start up our XML-RPC client library. */
00014     xmlrpc_client_init2(&env, XMLRPC_CLIENT_NO_FLAGS, "Client", "1.0", NULL, 0);
00015     /* Make the remote procedure call */
00016     resultP = xmlrpc_client_call(&env, url, methodName,  "(ii)", (xmlrpc_int32) 1, (xmlrpc_int32) 2);
00017     /* Get our state name and print it out. */
00018     xmlrpc_parse_value(&env, resultP, "i", &sum);
00019     printf("The sum  is %d\n", sum);
00020     /* Dispose of our result value. */
00021     xmlrpc_DECREF(resultP);
00022     /* Clean up our error-handling environment. */
00023     xmlrpc_env_clean(&env);
00024     /* Shutdown our XML-RPC client library. */
00025     xmlrpc_client_cleanup();
00026     return 0;
00027 }
00028 


agentsystem_examples
Author(s): k-okada
autogenerated on Mon Oct 6 2014 12:08:22