Facing new challenges everyday

Playing with J2ME

October 11th, 2007

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
import groovy.net.soap.SoapServer
def server = new SoapServer("localhost", 8888)
server.setNode("ManagementService")
server.start()

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.

Post to Twitter

No Comments »

No comments yet.

Leave a comment

:mrgreen: :neutral: :twisted: :shock: :smile: :???: :cool: :evil: :grin: :oops: :razz: :roll: :wink: :cry: :eek: :lol: :mad: :sad:
Imagem CAPTCHA

RSS feed for these comments. | TrackBack URI

Visitors Around the World

Polls

How Is My Site?

View Results

Loading ... Loading ...

Categories

Meta

Links

hosted by easy2use.net