Thanks Nadir. I have voted.
Another untested alternative was to use the HTTP header array output parameter with an entry of "X-Status-Reason: <reason for failure>"
Would this work with the 4xx / 5xx status codes?
Thanks again!
Mitch
-----Original Message-----
From: WEB400 [mailto:web400-bounces@xxxxxxxxxxxx] On Behalf Of Nadir Amra
Sent: Friday, June 02, 2017 11:46 AM
To: Web Enabling the IBM i (AS/400 and iSeries)
Subject: Re: [WEB400] IWS Rest Failure Response
At this time, no. IBM is working on adding the ability to do this. Vote for it in RFE [1]
[1]
https://www.ibm.com/developerworks/rfe/execute?use_case=viewRfe&CR_ID=90642
From: Mitch Gallman <mgallman@xxxxxxxxxxxx>
To: "web400@xxxxxxxxxxxx" <web400@xxxxxxxxxxxx>
Date: 06/02/2017 10:39 AM
Subject: [WEB400] IWS Rest Failure Response
Sent by: "WEB400" <web400-bounces@xxxxxxxxxxxx>
Using IWS I have a RESTful web service.
If some of the business validation fails for the request I return either a
403 or a 409. However, when setting a 4xx or 5xx status the output is not
returned to the client.
Is there a way for me to communicate the reason for the failure (ie
"Concurrent request not allowed", "Invalid User", "Not authorized for this
action", "Record already approved") back to the client while still using
those status codes?
My fallback plan is to return 200 Ok with output parameters with a generic
status field ("success"/"fail"/"error") and message field that would
indicate the reason for failure or error.
Mitch Gallman | U.S. Xpress, Inc.
IBM i Applications Developer
As an Amazon Associate we earn from qualifying purchases.