I started on the journey with Oracle service bus very recently even though I have been trying to catch this bus for a long time, but was never quite successful. It was quite different approach as considered to the more commonly used BPEL and ESB approach. Getting used to the Eclipse IDE, then exploring different options takes bit of your time to get familiarized. But as always new journeys give us more opportunities to learn.
One of the first hurdles that came up was with testing the business service. The scenario goes like this. There is a web service exposed in one of our target systems which we tried to consume as a Business service from OSB. Developing the Business service is very straight forward, but testing it and making it work looked cumbersome. As part of testing we were encountering ‘Bad Request’ Error even though the payload was thoroughly tested using SOAP UI. The response code returns response code as 400 which meant that the request was not even reaching the web service.
What OSB gives us to debug the issue?
OSB Console test window will give you Response Document and Response Metadata using which you need to figure out the error.
Response Document returns
The invocation resulted in an error: Bad Request.
Response Metadata returns
<tran:headers xsi:type="http:HttpResponseHeaders" xmlns:http="http://www.bea.com/wli/sb/transports/http" xmlns:tran="http://www.bea.com/wli/sb/transports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<http:Date>Fri, 03 Sep 2010 05:11:17 GMT</http:Date>
<tran:response-message xmlns:tran="http://www.bea.com/wli/sb/transports">Bad Request</tran:response-message>
So after a bit analysis and help from the Mohan the issue was found that the request was not getting forwarded to the external system and to ensure that the request gets forwarded to the end system we need to enable Follow HTTP redirects setting . By default HTTP redirect will be disabled.
How to enable the HTTP redirect setting?
Go to HTTP Transport tab in the business service.biz file. Go to Advanced settings -> Enable Follow HTTP redirects
What Follow HTTP redirects setting does?
A re-direct occurs when you send an outbound request to the URL of a business service, and that service returns a response code (for example, 302) that says the URL is no longer valid and this request needs to be sent to another URL. If the Follow HTTP Redirects check box is selected, Oracle Service Bus automatically re-sends the request to the new URL without any action on your part.
Another point to note is that 'chunked streaming mode' and 'follow HTTP redirects' setting cannot be enabled together. By default 'chunked streaming mode' will be enabled and HTTP redirects will be disabled. If you try to enable both settings of a business service, it will throw a compile time error mentioning
HTTP business service cannot have both 'chunked streaming mode' and 'follow HTTP redirects' options enabled.
That’s it to start off with, m back to work J