Openfire HTTP Bind

Hi all.

I am trying to connect to Openfire using JSJaC and HTTP Bind. I have performed the suggestions I have found in other posts an forums, namely setting JSJaCHBC_USE_BOSH_VER to FALSE and adding the line oArgs.authtype = ‘nonsasl’; to the simpleclient.html page. I have set up the rewrite on the apache server so that is directs http://localhost/http-bind (my http base) to http://localhost:8085/ (my openfire http bind url…I don’t have it set up with a trailing “http-bind” path). My problem is, when I try and connect, the response is the html code that comes when I directly access http://localhost:8085/, namely:

<html>
  <head><title>Openfire HTTP Binding Service</title></head>
  <body><font face="Arial, Helvetica"><b>Openfire <a href="http://www.xmpp.org/extensions/xep-0124.html">HTTP Binding</a> Service</b></font></body>
</html>

which of course is not correct. I have stepped through the javascript, and I am confident that the POST has the right element, and I have looked in the apache rewrite logs and it looks like the rewrite is at least redirecting to the correct url. If it wasn’t I would not get anything back at all. Can anyone suggest what might be wrong with my configuration?

Thanks in advance

Keith

It looks like it’s correct - that’s the response of the HTTP binding to a HTTP request.

Are you saying the simpleclient doesn’t connect? In that case, check all your server settings in config.js.

Sorry, maybe I have misunderstood how the POST request to the HTTP binding should work. When I browse to the openfire HTTP binding URL, then yea, I would expect the standard HTML response. However, when making a POST request to the HTTP binding URL, with an element included in the post which is:

{code:java} <body hold='1' xmlns='http://jabber.org/protocol/httpbind' to='192.168.0.5' wait='300' rid='222201' newkey='a4ec1d3ed43cc9d9d99c13e2e6a47598f2108b61' ver='1.6' xmpp:xmlns='urn:xmpp:xbosh' xmpp:version='1.0'/></code></pre><pre><code>
{code}

I would expect a different response, with <body/> tag containing the response attributes. Or have I gone wrong somewhere?

Just refreshed my client page, as I had forgotten to do so after setting the version use to false. The POST request now looks like:

<body hold='1' xmlns='http://jabber.org/protocol/httpbind' to='192.168.0.5' wait='300' rid='222201' newkey='a4ec1d3ed43cc9d9d99c13e2e6a47598f2108b61' />

Message was edited by: KeithT

just so no one waste any time puzzling over this, I have moved away from the Openfire HTTP binding and am now using the JabberHTTPBind client from Zeank. That works just fine in creating a HTTP connection to the Openfire server.

Hello KeithT you said that :“That works just fine in creating a HTTP connection to the Openfire server.” You can explain me how I can configure openfire in order to work with JabberHTTPBind. I can use Jwchat for test?

I’m trying to deploy an application wich need to comunicate by http, a web application with VoiceXML wihch work with a web server, so I need build the application using the web.

thank

Hi,

I have downloaded JsJac 1.3 and I am desperatly trying to make it work with Openfire 3.5.

I’ve tried adding the oArgs.authtype=‘nonsasl’ but it didn’t work.

I found in Openfire server settings that the http-binding is set to the port 7070, does that need to be explicitly set in jsjac ?

ALso, what is this Rewrite rule about? Do I need to create one for jsjac in my http server in order to work ?

I keep getting this error when I try to connect the sampleclient :

An error occured:

Code: 503

Type: cancel

Condition: service-unavailable

Can someone tell me how to do that step by step ?

I have exact the same problem!

I’m new to Openfire and use an Ubuntu Server with OpenFire 3.5.1.

I enabled HTTP-Binding via the Webinterface (on the default ports).

When using JsJac I enter 'http://<IP of my testserver>:7070/ ’ as HTTP Base.

In IE7 and Safari 3.1.1 I get:

An error occured:

Code: 503

Type: cancel

Condition: service-unavailable

In Firefox 2.0.0.14 I get:

[Exception… "Component returned failure code: 0xc1f30001

(NS_ERROR_NOT_INITIALIZED) http://nsIXMLHttpRequest.send" nsresult:

“0xc1f30001 (NS_ERROR_NOT_INITIALIZED)” location: "JS frame ::

file:///D:/Jabber-Net/jsjac-1.3/jsjac.js :: anonymous :: line 224"

data: no]

With the help of Fiddler I found out that the HTTP-Response is:

<html>

<head>

<meta http-equiv=“Content-Type” content=“text/html; charset=ISO-8859-1”/>

<title>Error 404 NOT_FOUND</title>

</head>

<body><h2>HTTP ERROR: 404</h2><pre>NOT_FOUND</pre>

<p>RequestURI=/</p><p><i><small><a href=“http://jetty.mortbay.org/”>Powered by Jetty://</a></small></i></p><br/>

<br/>

<br/>

<br/>

<br/>

<br/>

<br/>

<br/>

<br/>

<br/>

<br/>

<br/>

<br/>

<br/>

<br/>

<br/>

<br/>

<br/>

<br/>

<br/>

</body>

</html>

It works now. The problem was the Bind-url. It must be http://<ip of server>:7070/http-bind/

In Firefox I still get the same error, but I guess it’s because I use a local html file.

I tried it, but I get an now :s

Interesting. Should I be able to just navigate a browser to http://<ip of server>:7070/http-bind/ and not get the 404 response?

I still get a 404 when using a browser.

The 404 Error… Is it part of the protocol? Is it normal? Can someone point out the documentation of the Openfire HTTP Bind feature?

I am using Apache 2.2 and what is misleading in the documentation for JSJaC is the fact that the author specifies the need to rewrite URLs. That did not work for me. What you need is proxying - Apache needs to pass the request along to another server (Openfire).

Therefore, what you need to do is this:

  1. In the httpd.conf (Apache’s config file) - enable the following modules by removing the # if it appears at the beginning of their lines:
  • LoadModule proxy_module modules/mod_proxy.so
  • LoadModule proxy_http_module modules/mod_proxy_http.so
  1. In the httpd-vhosts.conf or wherever Virtual Hosts are defined, create a virtual host defining the proxy actions. What worked for me was:

<VirtualHost 127.0.0.1:80>
DocumentRoot “C:/www/” [Change this to match your web root folder]
AddDefaultCharset UTF-8
ProxyRequests On
ProxyPass /http-bind/ http://127.0.0.1:7070/http-bind/

  1. Restart Apache

  2. Place jsjac.js and simpleclient.html in the document root.

You should be good to go.

Hi,

I don’t know where you have been up to since this discussion, but as far as I am concerned, iI’m still at the same point: no move.

Anyway, here is an interesting link:

http://www.enavigo.com/2008/10/14/setting-up-jsjac-with-openfire-352/

I didn’t try it yet, but I’ll post my results as soon as I try it