Sometimes you might spend lot of time in analyzing the reason for getting 400 bad request when you invoke an up and running backend service through WSO2 ESB.
When you configure and save the synapse configuration of your proxy, you will not see any issue. But sometimes there can a possible reason for this issue.
One good example is explained below :
Look at the below synapse configuration of WSO2 ESB proxy service.
<proxy name="statuscodeProxy"
transports="https http"
startOnLoad="true"
trace="disable">
<description/>
<target>
<inSequence>
<log level="full"/>
<send>
<endpoint>
<address uri="http://10.100.0.31:8090"/>
</endpoint>
</send>
</inSequence>
<outSequence>
<log level="full"/>
<send/>
</outSequence>
</target>
</proxy>
By the look of it, this is alright and you are good to configure it in WSO2 ESB. But the endpoint defined as : http://10.100.0.31:8090 is not exactly the endpoint the backend service expects.
Sometimes there can be missing parameters etc. But if you exactly know your backend service does not expect any parameters and still it throws a 400 bad reques, can you imagine the reason for this?
After spending hours, I accidently found a possible reason :
it was due to the backend expects a / at the end of the endpoint. So it expects :
http://10.100.0.31:8090/ except http://10.100.0.31:8090
If you configure a tcpmon in between ESB and the backend, you will see the difference as below :
http://10.100.0.31:8090 : GET HTTP/1.1 - 400 bad Request
http://10.100.0.31:8090/ : GET / HTTP/1.1
- 200 OK
So if you too come across this situation, please try out this option. Sometimes this might save your time! :)
No comments:
Post a Comment