Layer7 API Management

  • 1.  Accessing status codes in global policy

    Posted Jan 09, 2019 12:35 PM

    Hi,

     

    I would like to catch all the generic faults( thrown by Gateway) within Global policy and structure the message according to my needs.  something like if the URI is not found I would like to throw 404 and json structure response rather than soap fault.  Similarly, if http method is not allowed then I would like to through different error codes.  Finally any un-handled assertion soap fault at service layer need to be caught and send with appropriate status codes to client.

    Please help me in achieving this using global policy so that I no need to code in every policy



  • 2.  Re: Accessing status codes in global policy
    Best Answer

    Broadcom Employee
    Posted Jan 09, 2019 07:20 PM

    Good afternoon,

     

    I would look to first create a catch all policy with the URI /* so that everything not found will go to this policy and then include a template response with the error code 404. As for the the HTTP method, please review this post Allowed Http Errors - Catch Exception and return Custom Error Response. For the last piece around capturing all the other errors, you can create a message-completed global policy to analyze the response. Do note that this could cause the response not to be streamed back to the client. Global Policy Fragments - CA API Gateway - 9.3 - CA Technologies Documentation 

     

    Sincerely,

     

    Stephen Hughes

    Broadcom Support