hi all<br>follwing is the sample code written using dbus, where there is one server<br>which has got method ManyArgs which i want to invoke from client.<br>Following is the code snippet,<br><br>MyServer.xml<br><br><?xml version="1.0" encoding="UTF-8" ?><br><br><node name="/com/example/MyServer"><br><br> <interface name="com.example.MyServer"><br> <annotation name="org.freedesktop.DBus.GLib.CSymbol" value="my_server"/><br> <method name="ManyArgs"><br> <!-- This is optional, and in this case is redunundant --><br> <annotation name="org.freedesktop.DBus.GLib.CSymbol" value="my_server_many_args"/><br> </method><br> </interface><br></node><br><br><br>MyServer.c<br>#include <stdio.h><br>#include <glib-object.h><br>#include <glib/gi18n.h><br>#include
<dbus/dbus-glib.h><br><br>#include "server.h"<br><br>static gboolean my_server_many_args()<br>{<br> if(1)<br> {<br> printf("\nmy_server_many_args\n"); <br> return TRUE; <br> }<br> return FALSE;<br>}<br><br>#include "my-server-glue.h"<br><br><br><br>static GMainLoop *loop;<br>DBusGConnection *connection;<br>static MyServer *server;<br><br>G_DEFINE_TYPE(MyServer, my_server, G_TYPE_OBJECT);<br><br>/* Class init */<br>static void<br>my_server_class_init (MyServerClass *my_server_class)<br>{<br> //g_type_class_add_private (e_data_book_factory_class, sizeof (EDataBookFactoryPrivate));<br> printf("\ni am class init\n");<br> dbus_g_object_type_install_info (G_TYPE_FROM_CLASS (my_server_class), &dbus_glib__object_info);<br>}<br><br>/* Instance init
*/<br>static void<br>my_server_init (MyServer *server)<br>{<br>}<br><br><br><br>int<br>main (int argc, char **argv)<br>{<br> GError *error = NULL;<br> guint32 request_name_ret;<br><br> g_type_init ();<br><br> loop = g_main_loop_new (NULL, FALSE);<br><br> /* Obtain a connection to the session bus */<br> connection = dbus_g_bus_get (DBUS_BUS_SESSION, &error);<br><br> if (connection == NULL)<br> {<br> printf("\nFailed to open connection to bus\n");<br> } <br><br> server = g_object_new (TYPE_MY_SERVER, NULL);<br> dbus_g_connection_register_g_object (connection,<br>
"/com/example/MyServer",<br> G_OBJECT (server));<br><br> g_main_loop_run (loop); <br> dbus_g_connection_unref (connection);<br> return 0;<br>}<br><br><br>MyClient.c<br>//#define DBUS_API_SUBJECT_TO_CHANGE<br><br>#include <dbus-1.0/dbus/dbus.h><br>#include <dbus-1.0/dbus/dbus-glib.h><br>#include "my-server-bindings.h"<br><br><br>int main (int argc, char **argv)<br>{<br> DBusGConnection *connection;<br> DBusGProxy *proxy; <br> DBusMessage *message; <br><br><br> GError *error;<br> char **name_list;<br> char **name_list_ptr;<br><br> guint32 request_name_ret;<br><br> g_type_init ();<br><br><br> error
= NULL;<br> connection = dbus_g_bus_get (DBUS_BUS_SESSION,<br> &error);<br> <br> if (connection == NULL)<br> {<br> g_printerr ("Failed to open connection to bus: %s\n",<br> error->message);<br> g_error_free (error);<br> exit (1);<br> }<br><br><br> /* Create a proxy object for the "bus driver" (name "org.freedesktop.DBus") */<br> <br> proxy = dbus_g_proxy_new_for_name
(connection,<br> DBUS_SERVICE_DBUS,<br> "/com/example/MyServer",//DBUS_PATH_DBUS,<br> "com.example.MyServer");<br><br> <br> // com_example_MyServer_many_args (DBusGProxy *proxy, GError **error) <br> if(!com_example_MyServer_many_args (proxy,&error))<br> //printf("i am
failed");<br> {<br> /* Just do demonstrate remote exceptions versus regular GError */<br> if (error->domain == DBUS_GERROR && error->code == DBUS_GERROR_REMOTE_EXCEPTION)<br> g_printerr ("Caught remote method exception %s: %s",<br> dbus_g_error_get_name (error),<br> error->message);<br> else<br> g_printerr ("Error: %s\n", error->message);<br> g_error_free (error);<br> exit (1);<br> }<br><br> g_object_unref (proxy);<br> return 0;<br>}<br><br>Steps I do,<br>I run first server program which according to me
registers object to dbus (object which has method ManyArgs)<br>Then I run client which establish connection with dbus and gives call<br>to ManyArgs,<br><br>Output I am getting is error:<br>Error: org.freedesktop.DBus does not understand message ManyArgs<br><br>Can anybody tell me what is wrong.<br>Any Pointers on it will be helpful.<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><p> 
        
        
                <hr size=1></hr>
Here’s a new way to find what you're looking for - <a href="http://us.rd.yahoo.com/mail/in/yanswers/*http://in.answers.yahoo.com/">Yahoo! Answers</a>