Layer7 API Management

  • 1.  Unable to capture DB errors

    Posted Jul 13, 2016 05:45 AM

    Hi All,

     

           I have created one webservice to retrieve the data from DB. Have created DB and able to connect to DB from Layer7 Policy Manager. I am using below assertion to run the select query.

     

    Perform JDBC query

     

    after that i did custom error message to capture if any failures like DB connectivity or any ORA errors but Layer7 not capturing any DB errors. Could you please let me know how to capture the same error what ever DB thrown.

     

    Thanks&Regards

    Rajasekhar



  • 2.  Re: Unable to capture DB errors

    Posted Jul 18, 2016 07:21 AM

    Hi All,

        Can someone please help me on this?

    Thanks&Regards

    Rajasekhar



  • 3.  Re: Unable to capture DB errors

    Broadcom Employee
    Posted Jul 19, 2016 04:07 PM

    Rajasekahr,

    Can you please be more specific on what you are expecting?

    Also what is the use case you are trying to achieve?



  • 4.  Re: Unable to capture DB errors

    Posted Aug 09, 2016 06:29 AM

    Hi Charles,

     

       Sorry for the delay. I was in vacation.

       Use case: I want to use webservice for retrieving the data from database.

     

       1. I have created the wsdl and Onboarded the wsdl in Policymanager

        2. Configured DB properties to connect to DB.

       

       I am able to connect to DB and retrieve the data from database by using my wsdl but when DB fails i am getting internal error it doesnt make sense at all.

       I need the error same as what DB returns like DB fails to connect layer7 or any data error?

     

    Hope you can understand now.

     

    Thanks&Regards

    Rajasekhar



  • 5.  Re: Unable to capture DB errors

    Posted Aug 25, 2016 03:48 AM

    I have this same question, but I have also found a quite good workaround. This workaround is as follows:

    you catch any error of the 'Perform JDBC query' assertion by putting it in a 'At least one...' folder'. Next to that assertion I included a policy fragment which retrieves the actual db error from the audit logs and returns a response containing the actual error message. Here I have a screenshot of the policy:

     

    What this policy does is running over all the audit details (using the audit context variable ${audit.details} that have been created so far, and looks for a audit detail with messageId = 9104, which is the code db errors get in the audit logs. The fullText-property of that detail is stored in a variable and will be overwritten by any audit detail with the same messageId that follows. That means you will in the end only get the latest db error, which is what you'll probably want. 



  • 6.  Re: Unable to capture DB errors

    Posted Aug 25, 2016 03:53 AM

    Although this solution works, it is not really nice (takes a lot of CPU cycles as well). I would expect that the Perform JDBC query returns a message like <prefix>.errorMessage, perhaps combined with something like <prefix>.found.  



  • 7.  Re: Unable to capture DB errors
    Best Answer

    Broadcom Employee
    Posted Aug 27, 2016 02:59 AM

    Raja,

     

    The same logic that has been presented above will provide the last audit message. To avoid the looping through a large amount of collected audit entries use the context variable ${audit.details.last.fullText} which will provide the last audit message for the failure in the JDBC Query.

     

    Sincerely,

     

    Stephen Hughes

    Director, CA Support



  • 8.  Re: Unable to capture DB errors

    Posted Sep 01, 2016 12:19 PM

    Hi Albert/Stephen,

     

        Thanks alot. It worked out and i am able to see the error message in my alert mail.

     

    Thanks&Regards

    Rajasekhar