Layer7 API Management

  • 1.  Publish localhost API

    Posted 10-18-2018 07:26 AM

    I have simple Java REST service running on: http://localhost:8080/student/list 


    I am trying to publish it through CA API Gateway:



    This is call from browser target URL:

    but when I try to call API from gateway I get this:


    What I am doing wrong ? In documentation PDF it is very simple explained with 2 steps like above, but it's not working. Any help will be appreciated!

  • 2.  Re: Publish localhost API

    Broadcom Employee
    Posted 10-18-2018 04:18 PM

    Hi Mensur,


    This is occurring because the service is published as /student/*.  This defines an endpoint where student is a required part of the URI followed by any other value. The endpoint of just /student is invalid and will not resolve. In the working screenshot we see /student/list which is valid.




  • 3.  Re: Publish localhost API

    Broadcom Employee
    Posted 10-18-2018 06:15 PM

    I agree with Joe, if you want to support both /student and /student/list, you may try setting resolution path as /student* rather than /student/*

    (edit the service properties to change resolution path)

  • 4.  Re: Publish localhost API

    Posted 10-19-2018 02:36 AM

    now I get this:

    and why is in PDF Documentation this:

    I assumed because of that that I must write it as "/student/*" and not "/student*"


    However, still doesn't work in both cases...

  • 5.  Re: Publish localhost API

    Broadcom Employee
    Posted 10-19-2018 10:48 PM

    I've reviewed what has been written and I'm curious as to where the service is being hosted. From your browser you are hitting the localhost of your machine whereby going through the gateway will not be the localhost where the service is being hosted. If you want to hit the service on your local machine you will need to ensure that the service is accessible outside of your machine and use the hostname in the HTTP Routing assertion in the service.


    The example in the documentation is just an illustration and depending on where the variance exists will need to move the * character to that point if all URIs are to be hit at /student/... then /student/* will work but if you have /student then you need to use /student*. A good rule of thumb is to create a catchall service at /* to handle all URIs that can not be resolved so you can return just a very clean 404 with a template assertion.




    Stephen Hughes

    Director, CA Support

  • 6.  Re: Publish localhost API

    Broadcom Employee
    Posted 10-21-2018 06:01 PM

    Hi Mensur,

    As you can see the error is different this time, that means the /student* is working and the url /student is resolved.

    The current error indicates you have problem on your policy, you can check from Audit Event Viewer, or in the ssg log to see the error detail of an assertion.


    (the PDF is just "for example”)




  • 7.  Re: Publish localhost API

    Posted 10-22-2018 08:02 AM

    I added inbound rule in my Windows Defender Firewall for 8443 port for gateway and also added outbound rule with 8085 port for my localhost REST app. I tried to call my localhost REST app service with my computer domain name, but no success!

    Then I changed my REST app port on 80, and tried to call localhost REST app with my computer full name and it works.


    I added this URL with my computer full name in gateway and published Web API service and I finally got response:





    Now I want to make my other REST actions to work. Example for "list" works for this, but I want to make my "show", "delete" and "create" API's to work, like:

    http://localhost/student/1 (GET request, get infos for student with ID 1)

    http://localhost/student (POST request, create new student with params name and age)

    http://localhost/student/1 (DEL request, delete student with ID 1)


    How can I map parameters to get all this to work in one published web api service ?

  • 8.  Re: Publish localhost API

    Broadcom Employee
    Posted 10-22-2018 12:22 PM

    For the various endpoints to work you need to ensure that on the Service Properties -> HTTP Tab you select the HTTP Methods allowed then on the HTTP Routing assertion you can use context variables to control the various input being sent through such as enter http://<yourHostName>${request.http.uri}${request.url.query}




    Stephen Hughes

    CA Support


  • 9.  Re: Publish localhost API

    Posted 10-23-2018 02:50 AM

    Thank you very much I will try. I wonder why this parameters mapping thing is not explained better in PDF documentation for CA API gateway and with more examples (specially for REST and SOAP services). If you have any valuable resources on this use-cases please post me link here. Thanks in advance!

  • 10.  Re: Publish localhost API
    Best Answer

    Broadcom Employee
    Posted 10-23-2018 11:46 AM

    The Publish reverse proxy functionality outlines a good starting point for moving traffic through the gateway Publish Reverse Web Proxy - CA API Gateway - 9.2 - CA Technologies Documentation 


    Another article that may shed some light is API Virtualization 




    Stephen Hughes

    CA Support