XIFF3 & Flex : policy-violation error

hi,

I am trying to build a very basic one2one chat based on XIFF3 and I am learning Flex2 along the process. I’ve buit a very simple client until now by reading the Sparkweb source code and trying to understand how it works, and also by taking some ideas from Paazmaya’s links here (http://www.igniterealtime.org/community/thread/32922).

The problem is I am getting a policy-violation error, this exception is thrown by the XIFFErrorEvent error handler. I have no idea how to locate the exact error nor when it happens since I am a very Flex & XIFF beginner. I just thought it has to do with the connection process and how to set the policy file, so here is the code I use to connect :

// set event handlers

connection.addEventListener(ConnectionSuccessEvent.CONNECT_SUCCESS, doConnectionSuccess);

connection.addEventListener(DisconnectionEvent.DISCONNECT, onDisconnection);

connection.addEventListener(LoginEvent.LOGIN , onLogin);

connection.addEventListener(PresenceEvent.PRESENCE, onPresence);

connection.addEventListener(XIFFErrorEvent.XIFF_ERROR, onXiffError);

connection.addEventListener(MessageEvent.MESSAGE, onMessage);

// connection args

connection.username = “hbr”;

connection.password = “123”;

connection.server = Server.toString();

connection.port = 7070 ;

connection.resource = resourceName;

Security.loadPolicyFile(“xmlsocket://” + Server.toString() + “:5229”);

Security.allowDomain( “*” );

Security.allowInsecureDomain("*");

connection.connect(“flash”);

// disable anonymous login

XMPPBOSHConnection.disableSASLMechanism(“ANONYMOUS”);

/code

Any thoughts ?

any idea about this error plz ?

This issue is fixed in openfire 3.5.2. There is no need to run the loadPolicy file because the crossdomain file is directly access through the socket port opposed to the alternate flash domain port. This was a major bug I found in my development because the loadPolicy wasn’t consistently loading correctly in the flash player.

thanks for answering. I’ll upgrade and see the results.

still getting the same error, with openfire 3.5.2

May be it hasn’t been fixed yet or the problem is elswhere …

I just realized that looking at your code that you’re doing the connection over HTTP binding and using Bosh. My solution works when you do a direct socket connection to port 5222 with the XMPPSocketConnection instead of the XMPPBOSHConnection.

Actually I am using the XMPPBOSHConnection because with the I get the “Not Authorized” error. I know it’s been discussed in many threads here but I couldn’t solve it.