It looks like the above approach is useless since openfire has a built in feature called " server-to-server" configuration where users form server A can add contact from server B and start a chat...
The only problem is that openfire 4.0.2 is unstable. I did follow this s2s tutorial https://community.igniterealtime.org/docs/DOC-1030. It worked but once the user is offline and reconnect after, the communication between the two users is lost.
Is there an old openfire version that is well known to provide a stable s2s connection without any issues ?