PunJab - A Jabber HTTP client interface.
PunJab is a HTTP, jabber client interface. It is a SOAP, XMLRPC, JEP-0025, or JEP-0124 server that allows persistent client connections to a jabber server. It can be used for many things, but its main purpose is to allow for stateless applications (ie web) a stateful connection to jabber.
News
Downloads
CVS
Docs
Bugs
JWChat HOWTO
Demo
XMLRPC API
About PunJab
XMLRPC Demo
SourceForge.net Logo

Punjab Demo


This page will describe in detail a working demo of punjab and a php xmlrpc client.

First, an overview of punjab. Punjab is sort of a blackbox. It has a xmlrpc api that client's make method calls to and it then converts them into jabber messages and returns them based on the methods the client's call. What goes on in between does not really matter to the client developer.


What problem are we trying to solve?


Punjab was created to allow stateless systems a way to interact with jabber, a very stateful system. Jabber or XMPP is a powerful, extendable, and easy to use xml messaging protocol. It is mostly used for instant messaging, but can be used for many other applications. Anyway, the problem the demo solves is web based instant messaging. Or a web based jabber client.

The details and getting this thing to work.


Step one is to setup punjab. To do this, all you need is a computer, python and twisted. Download punjab and follow the installation instructions in the INSTALL file. The dependencies are listed in the INSTALL file.

Step two is to setup punweb. This is what we are calling the demo code. The demo is just that, a demo. It is just meant for an example or a starting point for punjab. Download punweb from the releases section on the punjab project page.

Now, we untar that file in a web accessible directory.

shell> tar vxzf punweb-XXXXXXXX.tar.gz


Punweb is only tested with apache and php. It could work with other configurations but we are not going to say this demo works with anything else. You will also need the php xmlrpc class that is located here. Please follow the instructions on that page to set it up. It will need to be located in an includable directory. I put mine in the punweb 'include/xmlrpc/' directory.

So, we make sure the directory can support .htaccess overrides. Edit you httpd.conf file and put the following :

<Directory /var/www/punweb/>
    AllowOverride All
</Directory>

Then we copy config-example.inc.php to config.inc.php.

shell>cd /var/www/punweb/include/ 
shell>cp config-example.inc.php config.inc.php
shell>edit config.inc.php

<?php
  
if(!defined('_PUNJAB_INC')) {
     define('_PUNJAB_INC', TRUE);
  
     global $PUNJAB_GLOBAL;
 
     $PUNJAB_GLOBAL =  array (
############################
# backend setup
############################
# the default jabber resource if none is provided at login
'resource'      => "PunWeb", 
 # the default jabber server if none is provided at login
'jabber_server' => "localhost",
# the default port to the jabber server, if none is provided
'jabber_port'   => "5222", 
# the proxy to the xmlrpc punjab server
'proxy'    => "localhost:32080/?session=jabber_client",
# this is the uri to the xmlrpc punjab server 
'uri'      => "http://localhost:32080",
# tell punweb to use xmlrpcClient.php as its client class 
'use_xmlrpc'    => 1, 
 
 
);
}
 
?>


Then we edit our htaccess file.

shell>cd /var/www/punweb/
shell>edit .htaccess

php_value include_path "/var/www/punweb/include/:/usr/share/pear:/usr/share/php/"
php_flag magic_quotes_gpc OFF
# the below stuff is only if you want to force ssl
SSLRequireSSL
ErrorDocument 403 https://localhost/punweb/


We should now be set to run the demo. Please note that punweb has only been tested with mozilla and mozilla based browsers.

With a browser go to http://localhost/punweb/ There should be a javascript example to pop the demo window. Here is a screen shot :

You can also click here to see the working demo in this screen shot.

As the screen shot indicates you will be prompted with a username and password.

In this put the following :
username : anon
password : anon

For other servers, the format is the following :
jid@jabberserver.tld/jabberResource

For the password put your password for that jabber server.


After this you should be set. A window with your roster and some other actions should come up. Here is another screen shot :


GOOD LUCK!