Dispatching SOAP function calls
I would suggest to:


Define an interface with a method that will be called inside every case, e.g.

public interface ServiceMethod {
    public void execute();
}

Create a map that will contain contain instances of ServiceMethod findable by the a String key, e.g.:

Map&lt;String, ServiceMethod&gt; serviceMethodMap = new HashMap&lt;&gt;();

Fill up the serviceMethodMap map with ServiceMethod instances (this is to avoid the switch), e.g.:

serviceMethodMap.put("getTemperature", new ServiceMethod() {
    public void execute() {
        getDeviceTemp();
    });
serviceMethodMap.put("getBrightness", new ServiceMethod() {
    public void execute() {
        getBrightness();
    });   

Finally replace the switch with:

final ServiceMethod serviceMethod = serviceMethodMap.get(methodName);
if(serviceMethod != null) {
    serviceMethod.execute();
}





Update 2/18/2015, added Java 8 support


Define an interface with a method that will be called inside every case, e.g.

@FunctionalInterface
public interface ServiceMethod {
    public void execute();
}

Create a map that will contain contain instances of ServiceMethod findable by the a String key, e.g.:

Map&lt;String, ServiceMethod&gt; serviceMethodMap = new HashMap&lt;&gt;();

Fill up the serviceMethodMap map with ServiceMethod instances (this is to avoid the switch), e.g.:

serviceMethodMap.put("getTemperature", () -&gt; getDeviceTemp());
serviceMethodMap.put("getBrightness", () -&gt; getBrightness());

Finally replace the switch with:

final ServiceMethod serviceMethod = serviceMethodMap.get(methodName);
if(serviceMethod != null) {
    serviceMethod.execute();
}