2
votes

I have a rest api created using WSO2 ESB. I want to change the HTTP status code to 404 when the requested API resource does not match with the given URL. Currently I am getting a 'HTTP/1.1 202 Accepted' response. My esb version is 4.0.3.

3
I follwed the tutorial here but it didn't worked for me. charithaka.blogspot.com/2012/11/…. I want a similar solution.thanuja

3 Answers

12
votes

Try with <property name="HTTP_SC" value="404" scope="axis2"/>

0
votes

You can refer to wso2 documentation

<outSequence>
                 <property name="HTTP_SC" value="404" scope="axis2" />
                 <send/>
</outSequence>
-1
votes

The thing is when the URL is incorrect the request will not enter your code and will be answered by WSO2 ESB/EI itself. So in your code you don't have influence on the response in that case. Maybe it can be configured in WSO2 itself, can't find any on that yet.