Playing with J2ME
After some years away from mobile world I finally back with mobile development, I’ve been working on a application that solves some server management tasks like start/stop services, this application consists of two parts, a webservice written in Groovy and the J2ME client. The J2ME client can call webservice methods that will execute these management tasks, like a remote control.
I used GroovySOAP on webserver side, with GroovySOAP I could write the webserver used to publish the webservice and the webservice itself, the scripts for both modules (webserver and webservice) are described below:
ManagementServer.groovy
1 2 3 4 |
ManagementService.groovy
1 2 3 4 5 6 7 8 9 10 11 12 13 | public class ManagementService { String call(String command, String serviceName) { if(command == "restart") { "net stop ${serviceName}".execute(); Process process = "net start ${serviceName}".execute(); return process.text; } else if(command == "start" || command == "stop") { Process process = "net ${command} ${serviceName}".execute(); return process.text; } } } |
The J2ME client code can be found by clicking here.