OFBiz Services may complete successfully or return to the caller with one or more errors. Upon successful completion of a Service, OFBiz automatically commits any database transactions and maps the return parameters to the context before returning control to the caller.
If a Service encounters an error and returns to the caller through an error processing path, OFBiz will automatically rollback all transactions initiated for the Service and/or SECAs regardless of the Service definition settings. To manage error processing from within a Service implementation, use the OFBiz-provided Service utility API as shown in this recipe.
The following examples assume a Service implemented in Java. Other Service Engine supported languages will behave in a similar fashion, although utility usage (API) details may vary.
For Java and Groovy programs, be sure to include the OFBiz Service utility program with a Java package import statement:
import org.ofbiz.service.ServiceUtil...