You can use SOAP faults in JAX-WS Web Services. This way, you can throw a custom exception when the prerequisites are not found. The client has a better idea of what happened.
For that, you need an Exception with @WebFault
annotation. You can find a good example in Using SOAP Faults and Exceptions in Java JAX-WS Web Services - Eben Hewitt on Java.
In the Users Guide » GlassFish » Metro » JAX-WS you can find this example:
package fromjava.server;
import javax.jws.WebService;
@WebService
public class AddNumbersImpl {
/**
* @param number1
* @param number2
* @return The sum
* @throws AddNumbersException if any of the numbers to be added is
* negative.
*/
public int addNumbers(int number1, int number2) throws
AddNumbersException {
if (number1 < 0 || number2 < 0) {
throw new AddNumbersException("Negative number cant be " +
"added!", "Numbers: " + number1 + ", " + number2);
}
return number1 + number2;
}
}
The Exception:
package fromjavahandler.server;
public class AddNumbersException extends Exception {
String detail;
public AddNumbersException(String message, String detail) {
super(message);
this.detail = detail;
}
public String getDetail() {
return detail;
}
}
The JAX-WS runtime generate the Fault automatically.