ejabberd_xmlrpc configuration to access to simple commands

I have recently completed an xml_rpc client development using Borland C++.
The simple commands like echothis and multhis work fine, but I cannot query connected_users.
When I run the command from the Erlang Eshell V5.6.4 I:

xmlrpc:call({127, 0, 0, 1}, 4560, "/", {call, connected_users, []}).
xmlrpc:call({127, 0, 0, 1}, 4560, "/", {call, create_account, [{struct, [{user, "ggeo"}, {host, "austinmobile"}, {password, "gogo11"}]}]}).

I get the error:-

{ok,{response,{fault,-112,"Error -112\nUnknown call: {call,connected_users,[]}"}}}
{ok,{response,{fault,-112,"Error -112\nUnknown call: {call,create_account,\n[{struct,[{user,\"ggeo\"},\n
{host,\"austinmobile\"},\n {password,\"gogo11\"}]}]}"}}}

Settings are from a fresh ejabberd install with ejabberd_xmlrpc installed.

{4560, ejabberd_xmlrpc, [{maxsessions, 10}, {timeout, 5000}]},

I suspect that this is an access issue as these calls do not work on xmlrpc either.
Any help for this new user would be appreciatted.

AndyA from SA

The problem with the first

The problem with the first call is that ejabberd_xmlrpc expects a struct, even when there are no command arguments to provide:

xmlrpc:call({127, 0, 0, 1}, 4560, "/", {call, connected_users, [{struct, []}]}).

{ok,{response,
        [{struct,
             [{connected_users,
                  {array,
                      [{struct,[{sessions,"testuser@localhost/work"}]}]}}]}]}}

The problem with the second call is that you are calling a command that doesn't exist. Maybe it existed in an old version of the module.

Try this one instead:

xmlrpc:call({127, 0, 0, 1}, 4560, "/", {call, register, [{struct, [{user, "ggeo"},
  {host, "localhost"}, {password, "gogo11"}]}]}).

{ok,{response,[{struct,[{res,0},
                        {text,"User ggeo@localhost successfully registered"}]}]}}

You can get information about the available commands by calling in your shell:

$ ejabberdctl help register*

Many Thanks for your Help

I submitted a thanks earlier but it is not visible.
Thanks for your help.
AndyA from SA

empty struct?

Hi

badlop wrote:

The problem with the first call is that ejabberd_xmlrpc expects a struct, even when there are no command arguments to provide:

xmlrpc:call({127, 0, 0, 1}, 4560, "/", {call, connected_users, [{struct, []}]}).

Can we avoid using the empty structure?
Because I don't know how to create it in my php client. (I tried array(), array(null), array("")... nothing worked)

An other problem is I can make the authentication work.
I'm running ejabberd 2.1.4 (from bin installer).
Compiled ejabberd_xmlrpc (puts the beams ine ejabberd/lib/ejabberd-xxx).
Compiled xmerl from R12B-5 (puts the beams in ejabberd/lib/kernel-xxx)
When I run every command I get a -118 error.
Ex:

 17> xmlrpc:call({127, 0, 0, 1}, 4560, "/", {call, stats, [{struct, [{user, "adminjabber"}, {server, "192.168.67.123"}, {password, "pass"}]},{struct, [{name, "onlineusers"}]}]}).
{ok,{response,{fault,-118,
                     "Error -118\nA problem '{error,invalid_account_data}' occurred executing the command stats with arguments\n[{name,\"onlineusers\"}]"}}}

Did I something wrong?

Thx
Vincent

Empty struct now optional. Verify your auth info

Mataemon wrote:

Can we avoid using the empty structure?

Yes, I've modified the source code in SVN. Now that empty struct is optional.

Mataemon wrote:

17> xmlrpc:call({127, 0, 0, 1}, 4560, "/", {call, stats, [
{struct, [{user, "adminjabber"}, {server, "192.168.67.123"}, {password, "pass"}]},
{struct, [{name, "onlineusers"}]}]}).
{ok,{response,{fault,-118,
"Error -118\nA problem '{error,invalid_account_data}'

You must provide auth information of a local Jabber account.
Can you login to the Jabber account adminjabber@192.168.67.123
with password "pass" in ejabberd, using a Jabber client?

Example:
(ejabberd@localhost)7>
xmlrpc:call({127, 0, 0, 1}, 4560, "/", {call, stats, [
{struct, [{user, "badlop"}, {server, "localhost"}, {password, "mypass123"}]},
{struct, [{name, "onlineusers"}]}]}).
{ok,{response,[{struct,[{stat,1}]}]}}

BTW, I've added example PHP code in README.txt on how to provide that auth information.

thanks

badlop wrote:

Yes, I've modified the source code in SVN. Now that empty struct is optional.

It works. Thank you!

badlop wrote:

You must provide auth information of a local Jabber account.
Can you login to the Jabber account adminjabber@192.168.67.123
with password "pass" in ejabberd, using a Jabber client?

Yes with pidgin I can login this account to the server. Maybe my config is wrong. I have this :


{acl, admin, {user, "adminjabber", "192.168.67.123"}}.

{access, xmlrpcaccess, [{allow, admin}]}.
{listen,
 [

  {{4560, "127.0.0.1"}, ejabberd_xmlrpc, [
			 {maxsessions, 10},
			 {timeout, 5000},
			 {access_commands, [{xmlrpcaccess, all, []}]}
			]},
...


{auth_method, external}.
{extauth_program, "/usr/bin/php /usr/local/bin/JabberAuth_Ldap.php"}.

Syndicate content