void vortex_xml_rpc_accept_negotiation ( VortexXmlRpcValidateResource  validate_resource,
axlPointer  validate_user_data,
VortexXmlRpcServiceDispatch  service_dispatch,
axlPointer  dispatch_user_data 
)

Allow to start receiving incoming XML-RPC request, setting two handlers to validate and process them.

This function is provided to allow Vortex BEEP listeners to accept incoming XML-RPC invocations, by providing a resource validation handler and the service dispatch handler.

The first handler, the validation resource, is required to notify remote peers that we accept, and support a particular resource. See the validation resource handler to know more about this. This handler is not required. If NULL is provided, all validation request will be accepted (in fact an internal validation handler will be assigned which accept all incoming requests).

Once the resource validation process is accepted, the XML-RPC channel is created, and XML-RPC incoming request can start.

The second handler is provided to allow the user space to dispath service invocation received. This handler is not optional. Without it, the XML-RPC invocation can't be produced.

The function also register the XML-RPC profile to be advertised on the greetings phase.

Here is an example of a listener initializing the vortex engine to accept incoming XML-RPC requests:

 axl_bool validate_resource (VortexConnection * connection, 
                             int                channel_number,
                             char             * serverName,
                             char             * resource_path)
 {

        printf ("Resource to validate: '%s' (serverName='%s')\n", 
                 resource_path,
                 serverName != NULL ? 
               serverName : "no serverName value received");
        return axl_true;
 }

 int  __sum_2_int_int (int  a, int  b, 
                       char  ** fault_error, int  * fault_code)
 {
        if (a == 2 && b == 7) {
                // error reply example
                REPLY_FAULT ("Unable to sum the 2 and 7 values", -1, 0);
        }
        // return reply 
        return a + b;
 }

 XmlRpcMethodResponse * sum_2_int_int (XmlRpcMethodCall * method_call)
 {
        // get method values 
        int                 result;
        char              * fault_error = NULL;
        int                 fault_code  = -1;

        // get parameters 
        int  a = method_call_get_param_value_as_int (method_call, 0);
        int  b = method_call_get_param_value_as_int (method_call, 1);

        // perform invocation 
        result = __sum_2_int_int (a, b, &fault_error, &fault_code);
        
        // check error reply looking at the fault_error 
        if (fault_error != NULL) {
                // we have a error reply 
                return CREATE_FAULT_REPLY (fault_code, fault_error);
        }

        // return reply generated 
        return CREATE_OK_REPLY (XML_RPC_INT_VALUE, INT_TO_PTR (result));
 }

 XmlRpcMethodResponse *  service_dispatch (VortexChannel    * channel, 
                                           XmlRpcMethodCall * method_call, 
                                           axlPointer         user_data) 
 {
        
        printf ("*** channel %d, method call received %s (params %d)***\n",
                 vortex_channel_get_number (channel),
                 method_call_get_name (method_call), 
                 method_call_get_num_params (method_call));

        // check if the incoming method call is called sum, and has
        // two arguments 
        if (method_call_is (method_call, "sum", 2, 
                          XML_RPC_INT_VALUE, XML_RPC_INT_VALUE, -1)) {
                printf ("*** sum method found... ***\n");
                return sum_2_int_int (method_call);
                
        }
               
        // return that the method to be invoked, is not supported 
        return CREATE_FAULT_REPLY (-1, "Method call it not supported by this server");
 }

 int  main (int  argc, char  ** argv) 
 {

        // init vortex library 
        vortex_init ();

        // enable XML-RPC profile 
        vortex_xml_rpc_accept_negotiation (validate_resource,
                                           // no user space data for
                                           // the validation resource
                                           // function. 
                                           NULL, 
                                           service_dispatch,
                                           // no user space data for
                                           // the dispatch function. 
                                           NULL);

        // create a vortex server 
        vortex_listener_new ("0.0.0.0", "44000", NULL, NULL);

        // wait for listeners (until vortex_exit is called) 
        vortex_listener_wait ();
        
        // end vortex function 
        vortex_exit ();

        return 0;
 }

Parameters:
validate_resource The resource validation handler. This handler is not optional.
validate_user_data Optional user data to be passed in to the validation method.
service_dispatch The service dispatch handler. This handler is not optional.
dispatch_user_data Optional user data to be passed in to the dispatch method.