Did you try using the output vars instead of relying on the message context? Don’t throw an exception. Instead, if steps in the IS service throw an exception, catch it and return the appropriate/desired status code message using the defined output vars in the spec.
Exploring this a bit further, what is the rationale for enforcing “business logic” in the API Gateway? Shouldn’t the native service be doing that? Sometimes we have to do things “in the middle” because the endpoint cannot be touched, but in general the endpoint should enforce data rules not the gateway.
Don’t give up on this. This can be done. If you can share more detail about the API GW policies and the native service (without exposing sensitive info) the community should be able to help. I noticed that you marked an answer as accepted, but based upon what you’ve posted, that did not address what you are trying to do. That may mislead people who come across this thread in the future.
#API-Management#webMethods#API-Gateway