By Juergenkress-Oracle on Feb 20, 2015
I had an OSB consulting day at a customer. We looked into a REST
service that was to be extended with update functionality. Since calling
an update service of an EIS (Enterprise Information System) can go
wrong with all sorts of errors, it is important to be able to return a
fault-message with the errors, jason format.
Now in OSB12c it's very apparent how you define possible fault-messages and even how the should be formatted in JSON:
this sample case we created a more or less simple xsd for faults
(dutch: fouten). To test with different fault messages we simply
duplicated the 'fouten' element in the xsd to 'fouten2'. You can assign
different HTTP-status codes to the different fault.
So this is configuration is pretty simple and straight forward. But it is not quite clear in the documents how you would return a specific fault within your error-handlers in the pipeline.
Internally OSB works not only 'XML'-based but actually SOAP-based. So the trick in the end is to replace the body with a soap-fault message and the selection of the REST/JSON errormessage is done based on the structure of the document in the details-section of the SOAP-Fault. In the screen above, you would define for each fault message an xsd-element and apparently it validates the soap-fault-details content against each XSD defined, and the xsd against which the detail-content is valid points to the returned fault, with the corresponding HTTP Status.
For regular information on Oracle SOA Suite become a member in the SOA & BPM Partner Community for registration please visit www.oracle.com/goto/emea/soa (OPN account required) If you need support with your account please contact the Oracle Partner Business Center.