Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > XML > BOOK: Professional XMPP Programming with JavaScript and jQuery
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
BOOK: Professional XMPP Programming with JavaScript and jQuery
This is the forum to discuss the Wrox book Professional XMPP Programming with JavaScript and jQuery by Jack Moffitt; ISBN: 978-0-470-54071-8
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Professional XMPP Programming with JavaScript and jQuery section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
 
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old February 24th, 2010, 11:44 AM
Registered User
 
Join Date: Feb 2010
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Getting started with Chapter 3 - flXHR problem

Hi Jack, thanks for writing this great book. I am quite excited about working my way through it, but I need a little help to get really started. After trying to figure out for the past 8 hours what I'm doing wrong, I figured I'd post a message here.

I cannot get the Hello World example running. Firebug reports the following error:

15, securityError, A security sandbox error occured with the flXHR request.
AM()checkplayer.js (line 12)
AO()checkplayer.js (line 12)
checkplayer()checkplayer.js (line 12)
checkplayer()checkplayer.js (line 12)
aS()flXHR.js (line 2)
[Break on this error] (function(R){var E=R,V=R.document,N="u...I.module_ready=function(){ }})(window);


So my problem seems to be related to the crossdomains policy from flXHR.

My setup is the following: from my Windows XP desktop, I try to connect (using Firefox and the code from Chapter 3) to a Ubuntu 9.10 server, which is running the ejabberd server. I tried to follow the instructions of both Chapter 3 and Appendix B as much as possible. Both computers are on my local network. The server has the following settings in the ejabberd.cfg file:

%% Admin user
{acl, admin, {user, "gkamp", "ubuntuserver"}}.
%% Hostname
{hosts, ["ubuntuserver"]}.

and then further down the line, the html listening port:

{5280, ejabberd_http, [
web_admin,
{request_handlers, [
{["xmpp-httpbind"], mod_http_bind},
{[], mod_http_fileserver}
]}
]}

and finally the modules section:

{mod_http_bind, []},
{mod_http_fileserver, [{docroot, "/var/www"},
{content_types, [{".xml", "text/xml"}]}]}

I have the following crossdomains.xml file:

<?xml version="1.0"?>
<!DOCTYPE cross-domain-policySYSTEM "http://www.adobe.com/xml/dtds/cross-domain-policy.dtd">
<cross-domain-policy>
<site-control permitted-cross-domain-policies="all" />
<allow-access-from domain="*" />
<allow-http-request-headers-from domain="*" headers="*" />
</cross-domain-policy>

The hello.js file has the following connection details:
var conn = new Strophe.Connection(
"http://10.0.1.9:5280/xmpp-httpbind");

When I enter "http://10.0.1.9:5280/xmpp-httpbind" in my browser, I get the expected "Ejabberd mod_http_bind v1.2. An implementation of XMPP over BOSH (XEP-0206)" message.

I don't know if its related but before I activated the mod_http_fileserver in the request_handler section, I could use the webadmin interface, but after adding the mod_http_fileserver, the webadmin interface stopped working.



Also, I think I found a few small errors in the Appendix B:
- page 433: a square closing bracket is missing between the two curly closing brackets, after mod_http_bind (almost at the bottom of the page)
- page 434: same thing (almost at the top of the page)
- page 435: Icon says crossdomain.xml is available for download but its not included in the download package
- page 436: comma is missing after "/path/to/html"} (middle of the page)

Thanks!
  #2 (permalink)  
Old February 24th, 2010, 12:38 PM
Registered User
 
Join Date: Feb 2010
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Same problem

I downloaded the code from WROX yesterday (Feb 23) and have uploaded it to my webserver. I tried both http://bosh.metajack.im:5280/xmpp-httpbind as well as my own ejabberd install (similar setup to gkamp, but it's not on a local intranet), and both times I get the firebug error in the above post.

The same error also appears in Chrome (browser).

I was looking forward to using the code as I read through the book, and I hope this can be resolved.
  #3 (permalink)  
Old April 2nd, 2010, 04:05 PM
Registered User
 
Join Date: Apr 2010
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I'm having the same issue. I tried the following for the missing web_admin problem to no avail:

{5280, ejabberd_http, [
{request_handlers, [
{["xmpp-httpbind"], mod_http_bind},
{["admin"], web_admin},
{[], mod_http_fileserver}
]}
]}
  #4 (permalink)  
Old April 2nd, 2010, 04:07 PM
Registered User
 
Join Date: Apr 2010
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Also note that I can confirm that ejabberd is properly serving up http://example.com:5280/crossdomain.xml to the browser.
  #5 (permalink)  
Old April 2nd, 2010, 04:33 PM
Registered User
 
Join Date: Apr 2010
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Quote:
I don't know if its related but before I activated the mod_http_fileserver in the request_handler section, I could use the webadmin interface, but after adding the mod_http_fileserver, the webadmin interface stopped working.
I fixed this with: (Edit: No, this didn't work.)

Code:
  {5280, ejabberd_http, [
                        web_admin,
                         {request_handlers,     [{["xmpp-httpbind"],
                                                 mod_http_bind},
                                                {["crossdomain.xml"], mod_http_fileserver}
                                                ]}
                        ]}
(Edit: The crossdomain.xml file also now returns "eisdir" after doing that.)

Last edited by aaronwinborn; April 2nd, 2010 at 04:58 PM..
  #6 (permalink)  
Old April 2nd, 2010, 04:41 PM
Registered User
 
Join Date: Apr 2010
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I wonder if it's related to

Code:
  {mod_http_fileserver, [{docroot, "/var/www"},
                  {content_types, [{".xml", "text/xml"}]}]},
Note, as an example, that http://bosh.metajack.im:5280/crossdomain.xml is served up properly as an "application/xml" file, while in the example it's done as a "text/xml".

I changed that in the content types, however, and it still reports the error from flXHR. The browser still attempts to download the text rather than serving it up as the other.

Last edited by aaronwinborn; April 2nd, 2010 at 04:59 PM..
  #7 (permalink)  
Old April 2nd, 2010, 11:02 PM
Wrox Author
Points: 702, Level: 10
Points: 702, Level: 10 Points: 702, Level: 10 Points: 702, Level: 10
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jan 2010
Posts: 178
Thanks: 0
Thanked 16 Times in 15 Posts
Default

Sorry for the late reply. Somehow this thread escaped my attention until today.

I will check for those errors in the text; at the very least, I think the mime type must have gotten put in wrong. I'm pretty sure it should be "application/xml" not "text/xml".

So if you guys use http://bosh.metajack.im:5280/xmpp-httpbind, does everything work ok? Is the problem limited to your own ejabberd installs?

I assume you are serving the hello.html from a local web server as well, correct? It will not work if you try to access it via a file:// URL.
  #8 (permalink)  
Old April 2nd, 2010, 11:11 PM
Wrox Author
Points: 702, Level: 10
Points: 702, Level: 10 Points: 702, Level: 10 Points: 702, Level: 10
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jan 2010
Posts: 178
Thanks: 0
Thanked 16 Times in 15 Posts
Default

Ok, I've confirmed all the errors mentioned above and updated my errata file. I've also added to the missing crossdomain.xml policy file in the GitHub repo.

As for the mime type, it doesn't seem to matter if it's application/xml or text/xml.
  #9 (permalink)  
Old May 31st, 2010, 04:39 PM
Registered User
 
Join Date: May 2010
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hello, I have same problem with ejabber + mod_http problem. Pointing browser to example.com:5280/crossdomain.xml will force browser to download a file not show it. Its the same situation like aaronwinborn had but no replay with answer.
http://bosh.metajack.im:5280/xmpp-httpbind works perfectly but i prefere to use my own server. Does anybody have anser to this problem ?
  #10 (permalink)  
Old June 9th, 2010, 05:44 PM
Wrox Author
Points: 702, Level: 10
Points: 702, Level: 10 Points: 702, Level: 10 Points: 702, Level: 10
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jan 2010
Posts: 178
Thanks: 0
Thanked 16 Times in 15 Posts
Default

The book has a small error about the mimetype needed for crossdomain.xml. It must be application/xml instead of text/xml or it won't work.

Your browser may or may not be able to display that, but Flash should be satisfied if the mimetype is correct.
 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
flXHR issues maverickr BOOK: Professional XMPP Programming with JavaScript and jQuery 6 March 13th, 2014 03:30 PM
flXHR Security Exception with Dig grantcv1 BOOK: Professional XMPP Programming with JavaScript and jQuery 3 April 15th, 2010 01:09 AM
Getting started - Chapter 5 eno BOOK: Professional ASP.NET MVC 1.0 ISBN: 978-0-470-38461-9 1 November 17th, 2009 04:07 PM
Chapter 1 - Getting Started - Adding Connection roscoe BOOK: Wrox's ASP.NET 2.0 Visual Web Developer 2005 Express Edition Starter ISBN: 978-0-7645-8807-5 6 November 6th, 2006 05:03 AM
Getting started with chapter 12 Indigo11 BOOK: Beginning PHP, Apache, MySQL Web Development ISBN: 978-0-7645-5744-6 1 September 2nd, 2004 06:37 PM



All times are GMT -4. The time now is 10:42 PM.


Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.