ejabberd - Comments for "ejabberd-2.0.2 + ejabberd_xmlrpc" https://www.ejabberd.im/node/3247 en Ha! https://www.ejabberd.im/node/3247#comment-53713 <p>That was strange, but reinstalling PHP5 made example script to work. I gave up trying PHP4 version of script.</p> <p>Thanks for help.</p> Sun, 02 Nov 2008 19:27:45 +0000 xyu comment 53713 at https://www.ejabberd.im Khe... Guess what?! https://www.ejabberd.im/node/3247#comment-53711 <p>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 )! :-)<br /> Interested?<br /> So, simply:<br /> PHP4 - timeouts:<br /> <code>{tcp_serv,139,{xmlrpc_http,handler,timeout}}</code>(ejabberd.log)<br /> and PHP5 has no reaction, giving (immediate) empty response and saying</p> <div class="codeblock"><code>expat reports error code 3<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; description: no element found<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; line: 1<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; column: 0<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; byte index: -1<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; total bytes: 0</code></div> <p>while <code>$response = xmlrpc_decode($file);</code>, leaving no traces in any log(debug level is 5).</p> <p>Trunks are the latest: everytime I try to manage this task, i synchronize svn, and if any changes are noticed, I recompile :-)))</p> <p>As for configuration:</p> <div class="codeblock"><code>{listen,<br /> [<br />&nbsp;&nbsp;&nbsp; {4560, ejabberd_xmlrpc, [<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {ip, {192, 168, 100, 250}},<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {maxsessions, 10},<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {timeout, 5000},<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {access, all}]}<br />...</code></div> <p>I tried also <code>all</code> for IP, modifying PHP code to request from different, but no changes.</p> <p>Oh, one notice: when PHP4 script send incorrect(as for HTTP/1.1) request, the server responses like</p> <div class="codeblock"><code>HTTP/1.1 400 Bad Request<br />Content-Length: 0<br />Server: Erlang/1.13<br />Content-Type: text/xml</code></div> <p>so, it's not really dead :-))<br /> Special errors in PHP5-example(like "POASASST" except "POST" as method) didn't make any changes: just quick empty answer.<br /> And I also check available for <code>ejabberdctl</code> commands, and used the simples, which has no empty response: <code>registered_users</code>.<br /> The command from example(<code>user_resources</code>) returns empty, while user is offline. (At first, I thought, that could be the reason)</p> <p>Posting pre-generated request(from PHP4)</p> <div class="codeblock"><code>POST /RPC2 HTTP/1.1<br />User-Agent: XMLRPCClientmod_xmlrpc<br />Content-Type: text/xml<br />Content-Length: 303<br />&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;<br />&lt;methodCall&gt;<br />&lt;methodName&gt;registered_users&lt;/methodName&gt;<br />&lt;params&gt;<br /> &lt;param&gt;<br />&nbsp; &lt;value&gt;<br />&nbsp;&nbsp; &lt;struct&gt;<br />&nbsp;&nbsp;&nbsp; &lt;member&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp; &lt;name&gt;host&lt;/name&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp; &lt;value&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;string&gt;localhost&lt;/string&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp; &lt;/value&gt;<br />&nbsp;&nbsp;&nbsp; &lt;/member&gt;<br />&nbsp;&nbsp; &lt;/struct&gt;<br />&nbsp; &lt;/value&gt;<br /> &lt;/param&gt;<br />&lt;/params&gt;<br />&lt;/methodCall&gt;</code></div> <p>via telnet gives the same - timeout - result.</p> <p>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.<br /> Of course, it can be, that I have "broken" PHP5 :-)) I'll check it later, using another server :-)))<br /> Блять.<br /> Any ideas? :-))))</p> Fri, 31 Oct 2008 19:37:19 +0000 xyu comment 53711 at https://www.ejabberd.im Next attempt :-) https://www.ejabberd.im/node/3247#comment-53689 <p>:-))) Hi!<br /> Once again :-))<br /> Really, for the first time I used sources from <code>http://www.process-one.net/en/ejabberd/downloads/</code> page.<br /> Now I'll show step-by-step process of installing eJabberd+modules.<br /> 0) Fully reinstall (ported) Erlang(still having <code>erlang-r12b4</code>)<br /> 1) Synchronize SVN(ejabberd:1671;modules:799)<br /> 2) cd [path/to/ejabberd/svn/subdirectory]/2.0.x/src<br /> 3) <code>./configure</code> with the same options<br /> 4) gmake; gmake install<br /> 5) Modifying configuration(as in first post, but removing any "access" rule)<br /> 6) cd [path/to/ejabberd_modules/svn/subdirectory]/ejabberd_xmlrpc/trunk<br /> 7) ./build.sh<br /> 8) Copying ./ebin/*.beam to .../jabber/var/lib/ejabberd/ebin<br /> 9) Extract xmlrpc-1.13</p> <div class="codeblock"><code>cd xmlrpc-1.13/src;<br />gmake;<br />cp ../ebin/*.beam /home/jabber/var/lib/ejabberd/ebin;</code></div> <p>10) 6)-8) for mysql(as I used odbc authentication)<br /> 11) Starting ejabberd<br /> 12) Now have running server with working "messaging" service and listening on 4560(as ejabberd_xmlrpc)<br /> 13) But :-(( Still have crash of listener with any symbol, sent to this port.</p> <p>I tried an internal authentication also, but the result was the same.<br /> sasl.log:</p> <div class="codeblock"><code>=CRASH REPORT==== 27-Oct-2008::14:18:23 ===<br />&nbsp; crasher:<br />&nbsp;&nbsp;&nbsp; pid: &lt;0.201.0&gt;<br />&nbsp;&nbsp;&nbsp; registered_name: []<br />&nbsp;&nbsp;&nbsp; exception error: no case clause matching independent<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; in function&nbsp; ejabberd_socket:start/4<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; in call from ejabberd_listener:accept/3<br />&nbsp;&nbsp;&nbsp; initial call: ejabberd_listener:init(4560,ejabberd_xmlrpc,<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; [{ip,{192,168,100,250}},<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {maxsessions,10},<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {timeout,5000}])<br />&nbsp;&nbsp;&nbsp; ancestors: [ejabberd_listeners,ejabberd_sup,&lt;0.36.0&gt;]<br />&nbsp;&nbsp;&nbsp; messages: []<br />&nbsp;&nbsp;&nbsp; links: [#Port&lt;0.350&gt;,&lt;0.200.0&gt;,#Port&lt;0.333&gt;]<br />&nbsp;&nbsp;&nbsp; dictionary: []<br />&nbsp;&nbsp;&nbsp; trap_exit: false<br />&nbsp;&nbsp;&nbsp; status: running<br />&nbsp;&nbsp;&nbsp; heap_size: 377<br />&nbsp;&nbsp;&nbsp; stack_size: 23<br />&nbsp;&nbsp;&nbsp; reductions: 577<br />&nbsp; neighbours:<br />=SUPERVISOR REPORT==== 27-Oct-2008::14:18:23 ===<br />&nbsp;&nbsp;&nbsp;&nbsp; Supervisor: {local,ejabberd_listeners}<br />&nbsp;&nbsp;&nbsp;&nbsp; Context:&nbsp;&nbsp;&nbsp; child_terminated<br />&nbsp;&nbsp;&nbsp;&nbsp; Reason:&nbsp;&nbsp;&nbsp;&nbsp; {case_clause,independent}<br />&nbsp;&nbsp;&nbsp;&nbsp; Offender:&nbsp;&nbsp; [{pid,&lt;0.201.0&gt;},<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {name,4560},<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {mfa,<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {ejabberd_listener,start,<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; [4560,ejabberd_xmlrpc,<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; [{ip,{192,168,100,250}},<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {maxsessions,10},<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {timeout,5000}]]}},<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {restart_type,transient},<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {shutdown,brutal_kill},<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {child_type,worker}]</code></div> <p>ejabberd.log:</p> <div class="codeblock"><code>=INFO REPORT==== 2008-10-27 14:18:23 ===<br />I(&lt;0.201.0&gt;:ejabberd_listener:112) : (#Port&lt;0.350&gt;) Accepted connection {{192,168,100,250},56032} -&gt; {{192,168,100,250},4560}</code></div> <p>:-)<br /> 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> <p>P.S. Just before posting, I've reread Your answer and got, that 2.0.x is not what I need :-)) and tried <code>ejabberd/trunk/src</code>. 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 :-))</p> <p>2008-10-28:<br /> P.P.S. Just a sec. The crashing <code>.../trunk</code> 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.P.P.S But this alpha version works with ejabberd_xmlrpc at first sight :-)) Thanks for help and advice :-)</p> <p>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 <a href="http://www.ejabberd.im/ejabberd_xmlrpc" title="http://www.ejabberd.im/ejabberd_xmlrpc">http://www.ejabberd.im/ejabberd_xmlrpc</a>, because "ejabberd trunk SVN 1635 or newer" is not very clear condition(because there are alternative sources of distributions, like releases on commercial site <noindex><a href="http://www.process-one.net/en/ejabberd/downloads/" title="http://www.process-one.net/en/ejabberd/downloads/" rel="nofollow" >http://www.process-one.net/en/ejabberd/downloads/</a></noindex>).</p> Tue, 28 Oct 2008 15:06:17 +0000 xyu comment 53689 at https://www.ejabberd.im Works for me. Ensure you run ejabberd TRUNK svn. https://www.ejabberd.im/node/3247#comment-53675 <p>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</p> <p>Some advices:</p> <ul> <li>Are you sure you are using ejabberd trunk SVN, not the 2.0.x branch, right? </li><li>To start playing, don't put the 'access' option in the 4560 port. Once you get the XMLRPC calls working, you can focuse in security. </li><li>Use the PHP example client provided in the README.txt . Check the recent SVN, because I've updated it to work with ejabberd_xmlrpc correctly. </li><li>I think this is not important, this is only for completeness: I used Erlang R12B-3 (from Debian package), PHP 5.2.6 (Debian package) </li></ul> Tue, 21 Oct 2008 21:02:39 +0000 mfoss comment 53675 at https://www.ejabberd.im Some answers to simple questions https://www.ejabberd.im/node/3247#comment-53673 <div class="quote-msg"> <div class="quote-author"><em>xyu</em> wrote:</div> <p>I'm trying to setup ejabberd_xmlrpc, but smth. goes wrong.<br /> Is it smth. wrong with my system, or within module ejabberd_xmlrpc? :-)) </p></div> <p>I am not surprised: you are the first person to try ejabberd_xmlrpc, and probably you found some bug in it :)<br /> Thanks for your detailed explanations, I'll look them in detail this week and provide you a response to the main problem.</p> <p>Until then, I answer the simple questions:</p> <div class="quote-msg"> <div class="quote-author"><em>xyu</em> wrote:</div> <p>but what an irritating warnings appear while compiling patch?<br /> Can this be just ignored, or can it influence the working process in some way? </p></div> <p>Don't worry about all those warning messages of Erlang XMLRPC.</p> <div class="quote-msg"> <div class="quote-author"><em>xyu</em> wrote:</div> <p>send notification messages to registered users(not announcements, but personalized), not creating full-featured Jabber-bot with annoying authorization process for every single message.<br /> So if You know, that it is impossible with ejabberd_xmlrpc, just let me know, and mentioned problem will disappear at once. :-))) </p></div> <p>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: </p> <pre> $ ejabberdctl help send_message Command Name: send_message Arguments: from::string to::string subject::string body::string Returns: res::rescode Tags: stanza Description: Send a headline message to a local or remote bare of full JID </pre><p> 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:</p> <pre> This is an ejabberd module that adds an HTTP handler that allows HTTP clients to literally post arbitrary message stanzas to ejabberd. Those stanzas then get shoved through ejabberd's router just like any other stanza. </pre><p> In that case, maybe you need to enable this in your configure:</p> <div class="codeblock"><code> --enable-web=no \</code></div> Tue, 21 Oct 2008 18:40:36 +0000 mfoss comment 53673 at https://www.ejabberd.im