Influence Soap-fault

We are hosting a webservice that uses a xml-to-domain mapping in combination with microflows to search for objects. Sometimes a certain object for example country is not found because the client provides a wrong country code. Now we would like to provide a decent error soap-fault message that states why the order is not accepted. How can we alter the soap-fault message from internal-server error to a more descriptive one? Edit: Following up your responses we created a java action that throws a com.mendix.modules.webservices.WebserviceException. On my first attempt i added this java action to all my fetch microflows that i use in the mapping. However this was not enough as apparently the error generated inside the mapping is still caught and thrown as a internal server error. Than i tried to use custom error handling on my mapping call throwing the lasterrormessage. This does result in a different error message on the client side but the message does not equal the message i specified in all my fetch microflows. I now receive the following error message: <faultcode>Client</faultcode> <faultstring>Object of type 'Network.Node' with guid 281724084813832', objectstoreid '8' cannot be updated, as it does not exist anymore</faultstring> Is there a way to get my own specified error messages back? edit2: to follow up we created an extra java action that tries to get the last webservice exception and throws that one over the internal server error exception. Alas in the published microflow it cannot find the last exception using the get exception function. Could anyone explain what the function getException from UserAction. Edit3: The thing is we do not have 2 mendix applications, we have our esb that calls uppon our webservice and ports it to our clients. Furthermore we are not really using it in a conventional way. We want to avoid having a lot of temporarly objects thus we created a webservice that has a filedocument as input parameter. This filedocument contains an xml request that we can put in a mapping. Once inside the mapping we want to throw an exception if we encounter any problems due to invalid data e.g. non existing codes. In this setting we created a java action that throws a webservice exception in every 'find or create' microflow. However because you throw that exception the mapping is cancelled and returns another error making it impossible to catch that error inside mendix itself, because once you turn on error handling mendix throws away the exception stack and puts it inside the lasterror variable.
2 answers

With the next (not yet released) version of the Community commons you can throw a Webservice exception that communicates through soap faults back to the client.

(The current version has this method as well, but did not follow the conventions correctly)


For those that can't wait:

In the webservice exception that is thrown, the first param should be, WebserviceException.clientFaultcode, so change the code to:

throw new WebserviceException(WebserviceException.clientFaultCode, faultstring)


Things are getting more clear now, so you want to throw an exception while performing the mapping? In that case I think you should either (or both)

  1. loosen your mapping constraints and perform the data validation & throw after the mapping has been done (you could leave associations empty for example, and check on that afterwards)
  2. Or file a feature request to be able to throw custom exception while performing the data mapping. I think the current implementation assumes that if the input XML conforms to the XSD the data mapping should succeed. (Which makes sense to me)

Or for now just create a new WebserviceException in a java action, fill in the information and throw it.