API for adding gateway registrations

Hi,

I would like to add programmatically add gateway registrations, i.e. add a new “MSN” user to an existing openfire user/account.

Two questions:

  1. does the gateway jar have an API that allows adding registrations?

  2. I’ve download the source, but did not see the source in the ‘src/plugins’ directory. Subsequently, I bullt openfire, but not gateway.jar. Any reason why the gateway isn’t in the openfire source tree? Where can I take a look at the source?

thanks,

bill m

  1. http://www.igniterealtime.org/community/docs/DOC-1005 look under XML-RPC Interface

  2. Because it’s not “part of the openfire source”; it’s a separate project developed separately. See: http://www.igniterealtime.org/community/docs/DOC-1001

Hi,

Thanks for the followup.

Do you have an example of java calls to the gateway xml-rpc api? I coded an example following the “using an xmlrpc proxy” section in the redstone docs. here:

http://xmlrpc.sourceforge.net/#clients

example from redstone docs:

public static void main( String[] args ) throws Exception

{
    Jira jira = ( Jira ) XmlRpcProxy.createProxy( "http://jira.atlassion.com/RPC2", new Class[] { Jira.*class* } );
    String token = jira.login( args[ 0 ], args [ 1 ] );
    jira.logout( token );
}

I tried a similar example with the gateway api. The server returns a ‘handler not found’ error.

May 5, 2008 1:23:46 PM redstone.xmlrpc.XmlRpcDispatcher writeError

WARNING: The specified handler cannot be found

thanks,

bill m

found the answer by hunting through the xmlrpc and the gateway source code:

  1. You must declare an inner class with this name:“Manager”, i.e.:

/**

  • Gateway plugin

*/

public interface Manager

{

public boolean toggleTransport(String password, String transportName);

public String addRegistration(String password, String user, String transportType, String legacyUsername, String legacyPassword, String legacyNickname);

public String deleteRegistration(String password, String user, String transportType) ;

public String updateRegistration(String password, String user, String transportType, String legacyUsername, String legacyPassword, String legacyNickname) ;

public List<String> getActiveTransports(String password) ;

}

example calling via Proxy:

  URL url = new URL("http://myhost:9090/plugins/gateway/xml-rpc");

Class[] classes = new Class[]{Manager.class};

return ( Manager ) XmlRpcProxy.createProxy(url, classes,false);

The interface name must match the handler added in the gateway xml rpc server.

e.g.:

this.getXmlRpcServer().addInvocationHandler(“Manager”, conduit);