HI Kumar,
if the response code returned as 500, it will not stop the process.
However you can log the report and stop the process by following the code:
<dp:variable name="responsecode" />
<dp:url-open target="http://example.com/api" response="responsecode">
<!-- Request setup if needed -->
</dp:url-open>
<!-- Check the response code -->
<xsl:if test="$responsecode = 500">
<!-- Log the error -->
<dp:log level="error" category="apigw" xmlns:dp="http://www.datapower.com/extensions">
</dp:log>
<!-- Raise a fault to stop processing -->
<dp:raise-fault
name="HTTP500Error"
xmlns:dp="http://www.datapower.com/extensions"
description="Remote server returned HTTP 500 - Internal Server Error"/>
</xsl:if>
<!-- Continue with processing only if not error -->
If you want to play with the response code then you can use xsl:choose like below
<dp:variable name="responsecode" />
<dp:url-open target="http://example.com/api" response="responsecode">
<!-- Request setup if needed -->
</dp:url-open>
<!-- Check if response is 500 -->
<xsl:choose>
<xsl:when test="$responsecode = 500">
<!-- Log error -->
<!-- Raise fault and exit -->
<dp:raise-fault
name="HTTP500Error"
xmlns:dp="http://www.datapower.com/extensions"
description="Remote server returned HTTP 500 - Internal Server Error"/>
</xsl:when>
<xsl:otherwise>
<!-- Response is NOT 500: continue processing -->
<!-- Continue with your processing -->
<!-- e.g., transform, route, or respond -->
</xsl:otherwise>
</xsl:choose>
------------------------------
Nrusingha Sahoo
------------------------------