how to create gateway in spark messenger for chatting with other servers.

Are you using Openfire server? Then go to its Admin Console > Plugins > Available plugins and install IM Gateway plugin. Then enable needed gateways and configure them if needed. After this all enabled gateways should be available in Spark toolbar.