I have a little soap webservice. And I wonder how I can response with errors.
Eg:
public int createUser(String username) {
//create...
return id;
}
Now, if the user could not be created, how do I make a proper response? Do I have to throw a custom exception? Which is the right way?
The correct approach here is to translate the exception into a SOAP Fault.
I do this in my SOAP server - but don't fool around with trying to build your own Soap fault - simply throw a runtime exception and that should get converted into a soap fault.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With