Search code examples
oracle-databaseserviceosbbus

return oracle service bus error code


I'm creating a proxy in Oracle Service Bus 11G for a webservice. After receiving the request and when the response is 200, everything is ok, the OSB return the same 200 code.

Now, in my WebService I raise error 400, 406, 403, etc. depending of some logic processing but the OSB always raise error 500.

There's a way to make OSB forward the plain answer including the error code?

Thank you.


Solution

  • Add a fault handler to the business service

    Extract variables from data($fault//*:http-response-code) and data($fault//*:reason) (or something similar

    Insert:

    <http:http-response-code>$response_code_variable</http:http-response-code>
    as last child of
    ./ctx:transport/ctx:response
    In Variable – $inbound

    Insert:

    <tp:response-message>$response_reason_variable</tp:response-message>
    after ./ctx:transport/ctx:response/ctx:response-code
    In Variable – $inbound