Layer7 API Management

 View Only
  • 1.  How can i get the back end URL From the DB ?

    Posted Jun 21, 2020 09:17 AM
    Hi,
    How can i get the backend url in the DB ?  if not from the any internal API or from the browser [ just need the Service name , routing url & Backend URL]

    For example : I am having all the API services as REST & SOAP API services in my server,  how can i get the all the back end url's configured for the all the API services ?

    I tried the below query in the MYSQL but it's given me WDSL API's backend url , how can i get the REST service's Backend URL's ...?

    mysql> select name, routing_uri,wsdl_url from published_service;

    Thanks in advance. 





    ------------------------------
    [Consultant]
    [Quinnox]
    [Karnataka]
    ------------------------------


  • 2.  RE: How can i get the back end URL From the DB ?

    Broadcom Employee
    Posted Jun 22, 2020 06:24 PM
    Edited by Jay MacDonald Jun 22, 2020 06:26 PM
    The value of routing_uri represents the uri of the Gateway service, not the backend, and wsdl_url is the url within the wsdl for a SOAP service. The value of the backend url is inside in the policy XML itself, so you will need to query for policy_xml and parse that for //L7p:HttpRoutingAssertion/L7p:ProtectedServiceUrl/@stringValue, assuming the URL is hard coded in the routing assertion:

    <?xml version="1.0" encoding="UTF-8"?>
    <wsp:Policy xmlns:L7p="http://www.layer7tech.com/ws/policy" xmlns:wsp="http://schemas.xmlsoap.org/ws/2002/12/policy">
        <wsp:All wsp:Usage="Required">
            <L7p:HttpRoutingAssertion>
                <L7p:ProtectedServiceUrl stringValue="http://foo.com/bar"/>
                <L7p:RequestHeaderRules httpPassthroughRuleSet="included">
                    <L7p:ForwardAll booleanValue="true"/>
                    <L7p:Rules httpPassthroughRules="included">
                        <L7p:item httpPassthroughRule="included">
                            <L7p:Name stringValue="Cookie"/>
                        </L7p:item>
                        <L7p:item httpPassthroughRule="included">
                            <L7p:Name stringValue="SOAPAction"/>
                        </L7p:item>
                    </L7p:Rules>
                </L7p:RequestHeaderRules>
                <L7p:RequestParamRules httpPassthroughRuleSet="included">
                    <L7p:ForwardAll booleanValue="true"/>
                    <L7p:Rules httpPassthroughRules="included"/>
                </L7p:RequestParamRules>
                <L7p:ResponseHeaderRules httpPassthroughRuleSet="included">
                    <L7p:ForwardAll booleanValue="true"/>
                    <L7p:Rules httpPassthroughRules="included">
                        <L7p:item httpPassthroughRule="included">
                            <L7p:Name stringValue="Set-Cookie"/>
                        </L7p:item>
                    </L7p:Rules>
                </L7p:ResponseHeaderRules>
                <L7p:SamlAssertionVersion intValue="2"/>
            </L7p:HttpRoutingAssertion>
        </wsp:All>
    </wsp:Policy>

    Policies often have context variables in that field, so you will need to backparse whatever those are if such is the case. It is not trivial.

    Cheers!

    JayMac



    ------------------------------
    Jay MacDonald - Adoption Architect - Broadcom API Management (Layer 7)
    ------------------------------



  • 3.  RE: How can i get the back end URL From the DB ?

    Posted Jun 26, 2020 04:18 AM
    Hi Jay,

    Thanks for the reply.

    I have tried the suggested way by you . but i can see policy_xml result as NULL.
    Is there any other way now  to get the backend  url.

     


    ------------------------------
    [Senior Consultant]
    [Quinnox]
    [Karnataka]
    ------------------------------



  • 4.  RE: How can i get the back end URL From the DB ?
    Best Answer

    Broadcom Employee
    Posted Jun 29, 2020 07:58 PM
    I apologise... They changed how the DB is used since I last poked around in this part of the system, hence why policy_xml is now NULL. All of the policy XML is now in the xml field of the policy table. You can see them all using:

    SELECT name, xml FROM policy;

    If you want to know the master policy used by a specific service you need a join condition:

    SELECT s.name, p.xml FROM policy p, published_service s WHERE s.policy_goid=p.goid;

    ------------------------------
    Jay MacDonald - Adoption Architect - Broadcom API Management (Layer 7)
    ------------------------------