/* This file is part of libXMLRPC - a C library for xml-encoded function calls. Author: Dan Libby (dan@libby.com) Epinions.com may be contacted at feedback@epinions-inc.com */ /* Copyright 2000 Epinions, Inc. Subject to the following 3 conditions, Epinions, Inc. permits you, free of charge, to (a) use, copy, distribute, modify, perform and display this software and associated documentation files (the "Software"), and (b) permit others to whom the Software is furnished to do so as well. 1) The above copyright notice and this permission notice shall be included without modification in all copies or substantial portions of the Software. 2) THE SOFTWARE IS PROVIDED "AS IS", WITHOUT ANY WARRANTY OR CONDITION OF ANY KIND, EXPRESS, IMPLIED OR STATUTORY, INCLUDING WITHOUT LIMITATION ANY IMPLIED WARRANTIES OF ACCURACY, MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NONINFRINGEMENT. 3) IN NO EVENT SHALL EPINIONS, INC. BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES OR LOST PROFITS ARISING OUT OF OR IN CONNECTION WITH THE SOFTWARE (HOWEVER ARISING, INCLUDING NEGLIGENCE), EVEN IF EPINIONS, INC. IS AWARE OF THE POSSIBILITY OF SUCH DAMAGES. */ /* This is a simple demonstration of an xmlrpc client. This program * constructs an xmlrpc request and sends it to stdout. The output * is suitable for input to ./server. Of course in a real program, * the client would talk over a network, and would care about the * results but we do not. Various output options are available. * * For usage, see below or execute ./client --help * * See also ./sample which contains both this and ./server in * a standalone program. */ #include #include #include "xmlrpc.h" void print_help() { printf("Usage: client [OPTION VALUE]\n\n"); printf("\t-help this help message\n"); printf("\t-encoding (any standard character encoding)\n"); printf("\t-escaping (may repeat)\n"); printf("\t-method \n"); printf("\t-output \n"); printf("\t-verbosity \n"); printf("\t-version \n"); } int main(int argc, char **argv) { /* args */ int i; int verbosity = 0; int version = 0; int escaping = 0; int output = 0; char *methodName = "method_TestNormal"; char *encoding = 0; XMLRPC_REQUEST request; STRUCT_XMLRPC_REQUEST_OUTPUT_OPTIONS call_options; /* for every argument (after the program name) */ for(i=1; i 127 test. This should be the symbol for 1/4: ¼", 0); XMLRPC_VectorAppendInt(XMLRPC_RequestGetData(request), "int", 234); XMLRPC_VectorAppendDouble(XMLRPC_RequestGetData(request), "double", 234); XMLRPC_VectorAppendDateTime(XMLRPC_RequestGetData(request), "datetime", 0); XMLRPC_VectorAppendBase64(XMLRPC_RequestGetData(request), "base64", "Testing Base64", 0); { /* serialize client request as XML */ char *outBuf = XMLRPC_REQUEST_ToXML(request, 0); if(outBuf) { printf(outBuf); free(outBuf); } } if(request) { /* Free request */ XMLRPC_RequestFree(request, 1); } return 0; }