How to set HTTP Response Status Code in httpResponse object
Hi all,
I have a passthru REST setup using EnsLib.HTTP.GenericService and EnsLib.HTTP.GenericOperation. Works well.
I am adding some logic to the Operation and for some scenarios I want to return an HTTP 40x response status code.
I create an httpResponse object within the Business Operation, but I can't figure out how to set the http response status code that is returned to my Posstman client that initiated the request. I set StatusCode=400, and StatusLine and ReasonPhrase properties - but when the ultimate requestor (Postman) receives the response back it is a 200 status code. I am quitting the OnMessage method with status of $$$OK - which I suspect is being interpreted as HTTP response status code of 200. But I thought the httpResponse.StatusCode property setting of 400 would override that (?)
So how do I control the status code of the response? Can that be done within the httpResponse object within the Business Operation? Or do I need to subclass the related Business Service?