I have a MPGW (A) acting as a router service on our XI50 which intercepts all incoming HTTP requests and based on certain rules, it will dynamically route the request to another MPGW (B) on the same XI50 appliance for additional processing. The MPGW (B) then will dynamically route the request to a Message Broker back-end.
The issue that I'm having is preserving the HTTP response code and response message which is returned from the Message Broker back-end. In my case, Message Broker is returning an HTTP 404 Not Found and MPGW (A) is replacing this with an HTTP 200 OK. I believe I understand the reason why since there are two distinct transactions occurring. Once between the consumer/client and MPGW (A) and another between MPGW (A) and MPGW (B).
Since the ERROR rule doesn't fire in the policy of MPGW (B) for the Message Broker HTTP 404 Not Found, and the fact that an HTTP 200 OK was resulting from the calls, I modified the response rule with a transform action to execute the following (I've excluded the conditional logic):
<dp:set-http-response-header name= "'x-dp-response-code'" value= "'404 Not Found'"/>
When the response is returned from MPGW (B ) to MPGW (A), I have the same logic as well as debug statements within the response rule of MPGW (A). I can see that the return HTTP response code is a 404 Processed. However, before the response is sent from MPGW B, the value of x-dp-response-code is "HTTP 404 Not Found". I was able to eliminate the HTTP 200 OK, but I'm puzzled at how to ensure the proper message is associated with the proper 404 code.
I've also reviewed the prior postings:
This thread resembles the issue that I'm seeing the most:
However, the x-dp-response-phrase doesn't contain a value. I placed debug statements in the XSLT script and viewed the probe and x-dp-response-phrase doesn't even exist as a code/variable ...etc. I've also tried setting the system variable below (which I believe was suggested for the ERROR rule) and it too had no positive effect:
<xsl:variable name= "backendRespCode" select= "dp:http-response-header('x-dp-response-code')"/> <dp:set-variable name= "'var://service/error-protocol-reason-phrase'" value= "$backendRespCode" />
Perhaps I'm doing something incorrect and any suggestions would be greatly appreciated!