Search code examples
androideclipsesupsap-smp

How to check Relay Server existence in SAP Mobile Platform, and pairing server with Android App


This might seem a dumb question, but how do I find out if my SAP SMP 2.3 server has a relay server?

Additional data:

  • I have acquired basic knowledge while trying to make a HelloWorld project setup with SAP Mobile Platform 2.3 I want to read a few lines off a web service.

  • I have access to the SAP Mobile workspace, SAP Control Center, and the virtual machine where it runs, but I did not configure it so my insight about it is limited.

  • So far I have been able to read a few lines of data off a SAP webservice, and see them on the SMP workspace. My next step is to read this lines from my native Android app, but I am struggling determining which ports to use to synchronize my app, and I cannot connect it to the server.

    I get green and red message on Eclipse's logcat:

    failed to connect to IP adress bla bla, port bla

My code so far:

Application app = Application.getInstance(); 
            app.setApplicationIdentifier("SMPNostrum"); 
            app.setApplicationContext(SMPactivity.this); 
            Log.v("joshtag","Configuring Connection Properties");        
            ConnectionProperties connProps = app.getConnectionProperties();
            connProps.setServerName(SERVER_137);  //My server's IP
            // if you are using Relay Server, then use the correct port number for the Relay Server.
            // if connecting using http without a relay server, use the messaging administration port, by default 5001.
            // if connecting using https without a relay server, then use a new port for https, for example 9001.
            connProps.setPortNumber(SYNC_SERVER_PORT);//Port=2480
            // if connecting using https without a relay server, set the network protocol
            connProps.setNetworkProtocol("http");  
            connProps.setFarmId("0");
            connProps.setActivationCode("123");  
            // Set FarmId and UrlSuffix when connecting through the Relay Server. 
            // Provide user credentials
            LoginCredentials loginCred = new LoginCredentials("Samsung","my password here");
            connProps.setLoginCredentials(loginCred);
            connProps.setUrlSuffix("/ias_relay_server/client/rs_client.dll/%cid%/tm");  //is this necessary?
            // Initialize generated package database class with this Application instance
            SMPNostrumDB.setApplication(app);  
     
        ConnectionProfile cp=SMPNostrumDB.getSynchronizationProfile();
        cp.setServerName(SERVER_137);
        cp.setPortNumber(SYNC_SERVER_PORT);
        cp.setNetworkProtocol(PROTOCOL);        
        cp.setDomainName("default");
        cp.save();          
        
        Log.v("joshtag","Registering and connecting App");
     // If the application has not been registered to the server,register now
        if (app.getRegistrationStatus() != RegistrationStatus.REGISTERED){
            app.registerApplication(30000);
            //iniciaSincronitzacio(app.getRegistrationStatus() != RegistrationStatus.REGISTERED, sincronizar);
            }
        else{ 
            // start the connection to server
            app.startConnection(30000);
            }

Solution

  • Short answer:

    1. Relay server is not installed along with SMP installation.
    2. There are two communication channel for the application to talk to SMP, one is messaging and other is sync port. You can find both information on control center. connprop for application requires messaging port to be set and connection profile requires sync port to be set. In default setting for connprop, you can keep farm id as zero.

    The basic sequence is

    1. If not already registered, you register the application after setting the connection properties of application. Else call startconnection.
    2. The registration downloads down the synchronization connection settings from SCC. You set login information for synchronization profile, and call synchronization for the sync groups you want to synchronize.

    The connection settings can be seen on SCC under applications node in the left for your specific application grouped under application setting template. The determination of which template will be used is done using three parameters: Application name, security config and logical role. If you don't use logical role in your app, it will be application name and security config. This security config has be provided in the connection properties of application before registration.

    For details, visit http://infocenter.sybase.com and goto to the specific server version.