The Main.java file logs in to M-Business SOAP Server and sets up an environment from which calls can be made to the M-Business SOAP API.
The Java files that actually make the test calls to M-Business SOAP Server are located in the <M-Business_Home>/samples/java/tests/ directory, The file names indicate the groups of functions that each file tests:
TestConfigApi.java
TestGroupApi.java
TestUserApi.java
TestWebChannelApi.java
The following is the first call from TestConfigApi.java, logging in to M-Business SOAP Server:
// login to a session try { // NOTE: Make sure to set this to the exact same AuthKey string // that is in the ../conf/agsoap.conf file. // (otherwise you will keep seeing login failures because // the server won't be able to decrypt the password) String AuthKey = "your.authkey.here"; |
// Encrypt the password using the Blowfish BlowfishCrypt crypt = new BlowfishCrypt(); crypt.encrypt( AuthKey, AuthKey.length(), password, password.length() ); byte[] dest = crypt.getDest(); String b64password = base64.encode( dest ); |
// actually login as a user now RPCCall call = new RPCCall( /* SoapConfig */ sc, /* namespace */ "urn:AvantgoWebAPI", /* method */ "loginUser" ); |
// set parameters call.setParameter( /* name */ "userName", /* value */ userName, /* type */ String.class ); call.setParameter( /* name */ "b64password", /* value */ b64password, /* type */ String.class ); |
Send feedback about this page using email. | Copyright © 2008, iAnywhere Solutions, Inc. |