Fixed Java code to use the new services