OSB - Processing Http errors from Restful service in Proxy Service
I'm invoking a REST service from an OSB Proxy Service, which is working fine if the rest service response is a valid response, i.e., there's no errors. However if the rest service replies with an http error code (e.g. 400 Bad Request), I'm not able to capture anything else except the http error code:
$fault variable in OSB:
<con:fault xmlns:con="http://www.bea.com/wli/sb/context"> <con:errorCode>BEA-382502</con:errorCode> <con:reason> OSB Service Callout action received an error response </con:reason> <con:details> <con1:ErrorResponseDetail xmlns:con1="http://www.bea.com/wli/sb/stages/transform/config"> <con1:http-response-code>400</con1:http-response-code> </con1:ErrorResponseDetail> </con:details> <con:location> <con:node>PipelinePairNode1</con:node> <con:pipeline>PipelinePairNode1_request</con:pipeline> <con:stage>stage1</con:stage> <con:path>request-pipeline</con:path> </con:location> </con:fault>
But the rest service, is not only replying with 400 Bad Request, but also adding a message:
<Error> <Message>The message header contains an invalid brand code.</Message> </Error>
Which I'm not able to process in my proxy service. Does anyone knows if it is possible to access this message details in OSB or is it a limitation?
The rest service is clearly sending the message, because invoking it directly through soap-ui I'll get the following response:
HTTP/1.1 400 Bad Request Cache-Control: no-cache Pragma: no-cache Content-Length: 84 Content-Type: application/xml; charset=utf-8 Expires: -1 Server: Microsoft-IIS/8.5 X-AspNet-Version: 4.0.30319 X-Powered-By: ASP.NET Date: Mon, 09 Feb 2015 16:15:32 GMT <Error><Message>The message header contains an invalid brand code.</Message></Error>
I've just found out this is an OSB bug, in case of an HTTP Error code 400 being returned, if the http-content is "Application/XML" the message is ignored.
Oracle released a Patch at the end of last month to fix this issue, which I've tested and it works. I can get the message details in the $body variable now.
If I understand your question, you want to get in addition to the http code, the message error?
I think you should use, in your message flow, an errorHandler , so that you can catch the error and do whatever you want with.
The proxy service operation selection algorithm cannot determine the operation name from the request or returns an invalid operation (one which is not in the WSDL or null). Possible reasons include the following:
An error occurs while computing the operation.
The operation selection algorithm returns null.
The operation selection algorithm returns an operation that is not of the of the operations declared by the WSDL.