Hi,
I'm trying to setup ejabberd_xmlrpc, but smth. goes wrong.
(Though, the standard Jabber services work OK)
System parameters:
*OS: FreeBSD 6.2
*SVN:
-ejabberd: Checked out revision 1662.
-ejabberd-modules: Checked out revision 785
*Erlang: erlang-r12b4,1(with xmerl-1.1.10 included)
+ XML-RPC-Erlang 1.13 with IP, Ruby and Xmerl 1.x patches(xmlrpc-1.13-ipr2.tgz) used,
but what an irritating warnings appear while compiling patch?
erlc -W -I /usr/local/lib/erlang/lib/xmerl-1.1.10/inc -o ../ebin xmlrpc.erl
./xmlrpc.erl:117: Warning: this clause cannot match because a previous clause at line 113 always matches
erlc -W -I /usr/local/lib/erlang/lib/xmerl-1.1.10/inc -o ../ebin xmlrpc_decode.erl
./xmlrpc_decode.erl:40: Warning: this clause cannot match because a previous clause at line 35 always matches
./xmlrpc_decode.erl:189: Warning: variable 'Reason' is unused
erlc -W -I /usr/local/lib/erlang/lib/xmerl-1.1.10/inc -o ../ebin xmlrpc_encode.erl
./xmlrpc_encode.erl:56: Warning: variable 'Payload' is unused
./xmlrpc_encode.erl:58: Warning: variable 'Payload' is unused
./xmlrpc_encode.erl:129: Warning: variable 'Acc' is unused
./xmlrpc_encode.erl:129: Warning: variable 'Rest' is unused
./xmlrpc_encode.erl:129: Warning: variable 'Value' is unused
./xmlrpc_encode.erl:130: Warning: variable 'Acc' is unused
./xmlrpc_encode.erl:143: Warning: this clause cannot match because a previous clause at line 136 always matches
./xmlrpc_encode.erl:143: Warning: variable 'Acc' is unused
./xmlrpc_encode.erl:143: Warning: variable 'Rest' is unused
./xmlrpc_encode.erl:143: Warning: variable 'Value' is unused
./xmlrpc_encode.erl:144: Warning: variable 'Acc' is unused
erlc -W -I /usr/local/lib/erlang/lib/xmerl-1.1.10/inc -o ../ebin xmlrpc_http.erl
./xmlrpc_http.erl:68: Warning: variable 'Method' is unused
./xmlrpc_http.erl:69: Warning: variable 'HTTPVersion' is unused
./xmlrpc_http.erl:94: Warning: this clause cannot match because a previous clause at line 91 always matches
./xmlrpc_http.erl:102: Warning: variable 'ContentType' is unused
./xmlrpc_http.erl:168: Warning: variable 'NewState' is unused
./xmlrpc_http.erl:168: Warning: variable 'NewTimeout' is unused
erlc -W -I /usr/local/lib/erlang/lib/xmerl-1.1.10/inc -o ../ebin xmlrpc_util.erl
erlc -W -I /usr/local/lib/erlang/lib/xmerl-1.1.10/inc -o ../ebin tcp_serv.erl
./tcp_serv.erl:142: Warning: variable 'Reason' is unused
./tcp_serv.erl:154: Warning: variable 'DebugInfo' is unused
./tcp_serv.erl:154: Warning: variable 'Parent' is unused
Can this be just ignored, or can it influence the working process in some way?
Except this, `/usr/local/lib/erlang/lib/xmerl-1.1.10/inc'
does not exist, but it seems, that nothing is needed from that directory.
*ejabberd-2.0.2, compiled from sources as:
./configure \
--prefix=/usr/home/jabber \
--enable-mod_pubsub=no \
--enable-mod_irc=no \
--enable-mod_muc=no \
--enable-mod_proxy65=no \
--enable-eldap=no \
--enable-pam=no \
--enable-web=no \
--enable-tls=yes \
--enable-odbc=yes \
--enable-ejabberd_zlib=no \
--enable-hipe=no \
--enable-roster-gateway-workaround=no \
--enable-mssql=no \
--enable-transient_supervisors=yes \
--enable-full-xml=yes \
--with-erlang=/usr/local/bin \
--with-libiconv-prefix \
--with-expat \
--with-zlib \
--with-openssl=/usr/bin
*ejabberd.config(cut):
{loglevel, 5}.
{access, xmlrpcaccess, [{allow, all}]}.
{listen,
[
{4560, ejabberd_xmlrpc, [
{ip, {192, 168, 0, 1}},
{maxsessions, 10},
{timeout, 5000},
{access, xmlrpcaccess}]}
,
...
*`netstat -na'
tcp4 0 0 192.168.0.1.4560 *.* LISTEN
*PHP 4.4.7
*script:
<?php
$param=array(
"user"=>"username",
"host"=>"jabber.loc",
"password"=>"password"
);
$request = xmlrpc_encode_request('check_password', $param, (array('encoding' => 'utf-8')));
if( !$fp = fsockopen( "192.168.0.1", 4560, $errno, $errstr, 30) )
{
echo "[ERROR] $errstr ($errno)\n";
}
else
{
$out = "POST /RPC2 HTTP/1.1\r\n".
"User-Agent: XMLRPC::Client mod_xmlrpc\r\n".
"Content-Type: text/xml\r\n".
"Content-Length: ".strlen($request)."\r\n".$request;
$res=fwrite($fp, $out);
$file="";
while (!feof($fp)) {
$file.=fread($fp,1024);
}
fclose($fp);
echo "\n[$file]\n";
$response = xmlrpc_decode($file);
...
?>
###############################################
Running script leads to:
1) $file
is empty
2) while xmlrpc_decode()
, getting:
expat reports error code 3
description: no element found
line: 1
column: 0
byte index: -1
total bytes: 0
3) ejabberd.log:
=INFO REPORT==== 2008-10-20 09:01:23 ===
I(<0.194.0>:ejabberd_listener:112) : (#Port<0.384>) Accepted connection {{192,168,0,1},59541} -> {{192,168,0,1},4560}
4) sasl.log:
=CRASH REPORT==== 20-Oct-2008::09:01:23 ===
crasher:
pid: <0.194.0>
registered_name: []
exception error: no case clause matching independent
in function ejabberd_socket:start/4
in call from ejabberd_listener:accept/3
initial call: ejabberd_listener:init(4560,ejabberd_xmlrpc,
[{ip,{192,168,0,1}},
{maxsessions,10},
{timeout,5000},
{access,xmlrpcaccess}])
ancestors: [ejabberd_listeners,ejabberd_sup,<0.36.0>]
messages: []
links: [#Port<0.384>,<0.193.0>,#Port<0.331>]
dictionary: []
trap_exit: false
status: running
heap_size: 377
stack_size: 23
reductions: 565
neighbours:
=SUPERVISOR REPORT==== 20-Oct-2008::09:01:23 ===
Supervisor: {local,ejabberd_listeners}
Context: child_terminated
Reason: {case_clause,independent}
...
Trying `telnet 192.168.0.1 4560'
succeeds to connect, but sending a single character breaks connection and logs as above.
After crash, the module successfully restarts, getting connections, but behaves in crashing manner.
Is it smth. wrong with my system, or within module ejabberd_xmlrpc? :-))
I've looked through all "xmlrpc"-concerned posts and articles at www.ejabberd.im and not less count of results of world-wide search engines, and haven't found any solution.
Any ideas? :-)))
Small note: I intended to use this module to send notification messages to registered users(not announcements, but personalized), not creating full-featured Jabber-bot with annoying authorization process for every single message.
So if You know, that it is impossible with ejabberd_xmlrpc, just let me know, and mentioned problem will disappear at once. :-)))
Thanks.
Some answers to simple questions
I'm trying to setup ejabberd_xmlrpc, but smth. goes wrong.
Is it smth. wrong with my system, or within module ejabberd_xmlrpc? :-))
I am not surprised: you are the first person to try ejabberd_xmlrpc, and probably you found some bug in it :)
Thanks for your detailed explanations, I'll look them in detail this week and provide you a response to the main problem.
Until then, I answer the simple questions:
but what an irritating warnings appear while compiling patch?
Can this be just ignored, or can it influence the working process in some way?
Don't worry about all those warning messages of Erlang XMLRPC.
send notification messages to registered users(not announcements, but personalized), not creating full-featured Jabber-bot with annoying authorization process for every single message.
So if You know, that it is impossible with ejabberd_xmlrpc, just let me know, and mentioned problem will disappear at once. :-)))
If you get ejabberd_xmlrpc working, you can execute any 'ejabberd command' that is available in your ejabberd server. ejabberd trunk SVN provides several commands, and you can install modules that provide more commands. For instance, mod_admin_extra provides the command you want:
Another solution to your initial problem, unrelated to ejabberd_xmlrpc, is to use mod_rest (also available in ejabberd-modules SVN). I didn't try that module, but its README looks interesting:
In that case, maybe you need to enable this in your configure:
--enable-web=no \
Works for me. Ensure you run ejabberd TRUNK svn.
It works for me. I tried ejabberd trunk SVN 1662 with ejabberd_xmlrpc trunk from ejabberd-modules SVN 491. I configured similar to you, and tried the revised PHP client from README.txt
Some advices:
Next attempt :-)
:-))) Hi!
Once again :-))
Really, for the first time I used sources from
http://www.process-one.net/en/ejabberd/downloads/
page.Now I'll show step-by-step process of installing eJabberd+modules.
0) Fully reinstall (ported) Erlang(still having
erlang-r12b4
)1) Synchronize SVN(ejabberd:1671;modules:799)
2) cd [path/to/ejabberd/svn/subdirectory]/2.0.x/src
3)
./configure
with the same options4) gmake; gmake install
5) Modifying configuration(as in first post, but removing any "access" rule)
6) cd [path/to/ejabberd_modules/svn/subdirectory]/ejabberd_xmlrpc/trunk
7) ./build.sh
8) Copying ./ebin/*.beam to .../jabber/var/lib/ejabberd/ebin
9) Extract xmlrpc-1.13
cd xmlrpc-1.13/src;
gmake;
cp ../ebin/*.beam /home/jabber/var/lib/ejabberd/ebin;
10) 6)-8) for mysql(as I used odbc authentication)
11) Starting ejabberd
12) Now have running server with working "messaging" service and listening on 4560(as ejabberd_xmlrpc)
13) But :-(( Still have crash of listener with any symbol, sent to this port.
I tried an internal authentication also, but the result was the same.
sasl.log:
=CRASH REPORT==== 27-Oct-2008::14:18:23 ===
crasher:
pid: <0.201.0>
registered_name: []
exception error: no case clause matching independent
in function ejabberd_socket:start/4
in call from ejabberd_listener:accept/3
initial call: ejabberd_listener:init(4560,ejabberd_xmlrpc,
[{ip,{192,168,100,250}},
{maxsessions,10},
{timeout,5000}])
ancestors: [ejabberd_listeners,ejabberd_sup,<0.36.0>]
messages: []
links: [#Port<0.350>,<0.200.0>,#Port<0.333>]
dictionary: []
trap_exit: false
status: running
heap_size: 377
stack_size: 23
reductions: 577
neighbours:
=SUPERVISOR REPORT==== 27-Oct-2008::14:18:23 ===
Supervisor: {local,ejabberd_listeners}
Context: child_terminated
Reason: {case_clause,independent}
Offender: [{pid,<0.201.0>},
{name,4560},
{mfa,
{ejabberd_listener,start,
[4560,ejabberd_xmlrpc,
[{ip,{192,168,100,250}},
{maxsessions,10},
{timeout,5000}]]}},
{restart_type,transient},
{shutdown,brutal_kill},
{child_type,worker}]
ejabberd.log:
=INFO REPORT==== 2008-10-27 14:18:23 ===
I(<0.201.0>:ejabberd_listener:112) : (#Port<0.350>) Accepted connection {{192,168,100,250},56032} -> {{192,168,100,250},4560}
:-)
As soon as I have free time, I'll try to use older version of Erlang, not ported for FreeBSD, but downloaded from their own site :-)))
P.S. Just before posting, I've reread Your answer and got, that 2.0.x is not what I need :-)) and tried
ejabberd/trunk/src
. But I was surprised at crashing ejabberd at startup even with default configuration :-)) So... I'm lost in conjectures for now :-)) Hope, I will be able to manage it with next attempt :-))2008-10-28:
P.P.S. Just a sec. The crashing
.../trunk
installation was "repaired" by killing remaining processes of erlang, running in daemon mode. But I found, that this version is 2.1.0-alpha :-)) So, I guess, that is not, what I really need as working application :-))P.P.P.S But this alpha version works with ejabberd_xmlrpc at first sight :-)) Thanks for help and advice :-)
A small suggestion: if ejabberd_xmlrpc is not supposed to work with pre-2.1.x versions of ejabberd, it would be nice to notice that fact on http://www.ejabberd.im/ejabberd_xmlrpc, because "ejabberd trunk SVN 1635 or newer" is not very clear condition(because there are alternative sources of distributions, like releases on commercial sitehttp://www.process-one.net/en/ejabberd/downloads/ ).
Khe... Guess what?!
Right, the scripts are not working :-)) Neither my version for PHP4(in lots of variations and tunings) nor PHP5 Example(raw, modified, re-modified, re-re-modified and so on )! :-)
Interested?
So, simply:
PHP4 - timeouts:
{tcp_serv,139,{xmlrpc_http,handler,timeout}}
(ejabberd.log)and PHP5 has no reaction, giving (immediate) empty response and saying
expat reports error code 3
description: no element found
line: 1
column: 0
byte index: -1
total bytes: 0
while
$response = xmlrpc_decode($file);
, leaving no traces in any log(debug level is 5).Trunks are the latest: everytime I try to manage this task, i synchronize svn, and if any changes are noticed, I recompile :-)))
As for configuration:
{listen,
[
{4560, ejabberd_xmlrpc, [
{ip, {192, 168, 100, 250}},
{maxsessions, 10},
{timeout, 5000},
{access, all}]}
...
I tried also
all
for IP, modifying PHP code to request from different, but no changes.Oh, one notice: when PHP4 script send incorrect(as for HTTP/1.1) request, the server responses like
HTTP/1.1 400 Bad Request
Content-Length: 0
Server: Erlang/1.13
Content-Type: text/xml
so, it's not really dead :-))
Special errors in PHP5-example(like "POASASST" except "POST" as method) didn't make any changes: just quick empty answer.
And I also check available for
ejabberdctl
commands, and used the simples, which has no empty response:registered_users
.The command from example(
user_resources
) returns empty, while user is offline. (At first, I thought, that could be the reason)Posting pre-generated request(from PHP4)
POST /RPC2 HTTP/1.1
User-Agent: XMLRPCClientmod_xmlrpc
Content-Type: text/xml
Content-Length: 303
<?xml version="1.0" encoding="utf-8"?>
<methodCall>
<methodName>registered_users</methodName>
<params>
<param>
<value>
<struct>
<member>
<name>host</name>
<value>
<string>localhost</string>
</value>
</member>
</struct>
</value>
</param>
</params>
</methodCall>
via telnet gives the same - timeout - result.
I have no thoughts not to believe Your words as for everything works for You, so I guess, the problem is in system configurations, or simply in OS differences.
Of course, it can be, that I have "broken" PHP5 :-)) I'll check it later, using another server :-)))
Блять.
Any ideas? :-))))
Ha!
That was strange, but reinstalling PHP5 made example script to work. I gave up trying PHP4 version of script.
Thanks for help.