on 10-22-2012 8:40 PM
Hi all,
I am trying to register a native Android app without usage of a Relay Server but the connection to the SUP fails due to some Relay Server URL Template. This is an excerpt from the console:
registerApplication
com.sybase.mobile.ApplicationRuntimeException: Could not connect to server. Verify Relay Server URL Template
at com.sybase.sup.client.mbs.SupHandler.pingMessagingServer(SupHandler.java:162)
at com.sybase.mobile.Application$1.run(Application.java:376)
Caused by: Error: 558 Message: 'Could not connect to server. Verify Relay Server URL Template'
at com.sybase.mo.MoObject.ConvertTmExceptionToMoException(MoObject.java:868)
at com.sybase.mo.MoObject.execute(MoObject.java:683)
at com.sybase.sup.client.mbs.SupMoObject.sendMessageToServer(SupHandler.java:787)
at com.sybase.sup.client.mbs.SupHandler.pingMessagingServer(SupHandler.java:157)
My device is in the same local network as the SUP server.
This is the application code:
Application app = Application.getInstance();
app.setApplicationIdentifier("submobileapp");
ApplicationCallback appCallback = new DefaultApplicationCallback();
app.setApplicationCallback(appCallback);
app.setApplicationContext(getApplicationContext());
SUBMobileAppDB.setApplication(app);
SUBMobileAppDB.initialize();
ConnectionProperties connProps = app.getConnectionProperties();
connProps.setServerName("mySUP");
connProps.setPortNumber(5001);
connProps.setActivationCode("abc");
connProps.setFarmId("0");
connProps.setSecurityConfiguration("admin");
LoginCredentials loginCred = new LoginCredentials("supAdmin", "supAdmin");
connProps.setLoginCredentials(loginCred);
if (app.getRegistrationStatus() != RegistrationStatus.REGISTERED) {
app.registerApplication(100); // this is where the error occurs
connProps.setActivationCode("abc");
} else {
app.startConnection(100);
}
ConnectionProfile connProfile = SUBMobileAppDB.getConnectionProfile();
connProfile.setProperty("databaseFile", android.os.Environment.getExternalStorageDirectory().getPath());
connProfile.setEncryptionKey("encryption key must be 16 characters or longer");
connProfile.setCacheSize(102400);
connProfile.save();
ConnectionProfile cp = SUBMobileAppDB.getSynchronizationProfile();
cp.setServerName("mySUP");
cp.setPortNumber(2480);
cp.setAsyncReplay(true);
cp.setNetworkProtocol("http");
cp.setDomainName("default");
cp.save();
if (!SUBMobileAppDB.databaseExists()) {
SUBMobileAppDB.createDatabase();
}
SUBMobileAppDB.openConnection();
SUBMobileAppDB.synchronize("system");
SUBMobileAppDB.synchronize();
Can anyone give me a hint what might be wrong?
Cheers,
Marcus
Hi Marcus,
What is the mySUP in the host name. If you are keeping your device in the same domain as the server then the local ip of the server will work but in case your device is outside the domain in which the server is installed either you will require a relay server or have to make the local ip where the SUP Server is installed as the public ip.
I dont see anything wrong in your code.
What i am assuming is you are trying to access the server from outside with the local ip which will never happen.
And instead of giving the server name as mySUP its better you give the IP Address.
Hope this helps.
Thanks
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Marcus,
am not sure what is wrong in your code.
but am sharing mine below....m currently using dis code and it works....
let me know if you have any questions
//-----------------------Credentials---------------------------
private static String USERNAME = "supAdmin";
private static String PASSWORD = "s3pAdmin";
private static String HOST = "172.17.110.108";
private static int PORT = 5001;
private static int TIMEOUT = 600;
//---------------------Registration and Synchronization ---------------
Application app = Application.getInstance();
if (app.getApplicationIdentifier() == null)
app.setApplicationIdentifier("AndroidSUPDemo");
app.setApplicationContext(AndroidDemoActivity.this);
new Thread(new Runnable() {
public void run() {
try {
AndroidSUPDemoDB.setApplication(app);
AndroidSUPDemoDB.getSynchronizationProfile().setServerName(HOST);
LoginCredentials loginCredentials = new LoginCredentials(
USERNAME, PASSWORD);
ConnectionProperties connProps = app
.getConnectionProperties();
connProps.setLoginCredentials(loginCredentials);
connProps.setServerName(HOST);
connProps.setPortNumber(PORT);
if (app.getRegistrationStatus() != RegistrationStatus.REGISTERED) {
app.registerApplication(TIMEOUT);
} else {
app.startConnection(TIMEOUT);
}
if (!AndroidSUPDemoDB.isSynchronized("default")) {
AndroidSUPDemoDB.disableChangeLog();
AndroidSUPDemoDB.synchronize(); // Initial
// Synchronize
SynchronizationGroup sg = AndroidSUPDemoDB
.getSynchronizationGroup("default");
sg.setEnableSIS(true);
sg.save();
AndroidSUPDemoDB
.synchronize();
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
86 | |
10 | |
10 | |
9 | |
7 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.