Service Virtualization

Expand all | Collapse all

Lisa Invoke API issue.

Jump to Best Answer
  • 1.  Lisa Invoke API issue.

    Posted 02-28-2018 04:24 PM
      |   view attached

    I am trying to manage my Virtual services by using Lisa Invoke API.

     

    Below are the steps I have performed.

     

    1. I have added below property into local.properties file in my local machine.

         ( lisa.invoke2.swagger.basepath=http://registryname:1505/api/Dcm)

    2. accessed API url  http://registryname:1505/api/swagger/ in browser.

    3.  Page loaded with list of options.

    4. I want to start/stop one of the virtual service(ABC) which was deployed into VSE.

     

    Now my questions are,

    1. I want start/stop my virtual service which was deployed into VSE. which option should I select?

    ex. start a virtual service in a VSE?

    2. I think we should add below path into VSE server side?    lisa.invoke2.swagger.basepath=http://registryname:1505/api/Dcm

    3. I have selected Stop a virtual Service in a VSE. where we need to provide service name and Virtual service name.

       could some one suggest what is the service name and VSname here?



  • 2.  Re: Lisa Invoke API issue.
    Best Answer

    Posted 02-28-2018 05:06 PM

    ServiceName is used in the event your installation has more than one VSE service running under a Registry. Most likely the name of the VSE is "VSE" which is the default. To verify your service name, access the Portal, CLICK Monitor, Under Virtual Service Environments select the one you want to use:

     POST /VSEs/VSE/{virtualServiceName}/actions/stop

    virtualServiceName is the name of the virtual service.  In the below example, fakeResponder would be used.

    http://localhost:1505/api/Dcm/VSEs/VSE/fakeResponder/actions/stop

     

    Example:

    http://localhost:1505/api/Dcm/VSEs/VSE

    Returns (edited):

    <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    <Vse xmlns="http://www.ca.com/lisa/invoke/v2.0"
          name="VSE" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          :

          <status>2</status>
          <HostAddress><myComputer></HostAddress>
          <VirtualServiceList href="http://localhost:1505/api/Dcm/VSEs/VSE"       type="application/vnd.ca.lisaInvoke.virtualServiceList+xml">
             <VirtualService name="fakeResponder"
                href="http://localhost:1505/api/Dcm/VSEs/VSE/fakeResponder"             type="application/vnd.ca.lisaInvoke.virtualService+xml">
                <ModelName>fakeResponder</ModelName>

                :

                <AutoRestartEnabled>true</AutoRestartEnabled>
                :
                <Link href="http://localhost:1505/api/Dcm/VSEs/VSE/fakeResponder/actions" rel="down"/>
                <Link href="http://localhost:1505/api/Dcm/VSEs/VSE/fakeResponder/actions/start" rel="start"/>
                <Link href="http://localhost:1505/api/Dcm/VSEs/VSE/fakeResponder/actions/stop" rel="stop"/>
                <Link href="http://localhost:1505/api/Dcm/VSEs/VSE/fakeResponder/actions/resetCounts" rel="resetCounts"/>
          </VirtualService>
       </VirtualServiceList>
       :

    </Vse>



  • 3.  Re: Lisa Invoke API issue.

    Posted 03-01-2018 09:45 AM

    Hi Joel,

    Thanks for the reply.

     

    I have tried to stop the virtual service by using IE(updated localhost and Virtual service name). But got a error message.

    http://localhost:1505/api/Dcm/VSEs/VSE/fakeResponder/actions/stop

    Error Message:

    1008Method Not Allowed javax.ws.rs.WebApplicationException at com.sun.jersey.server.impl.uri.rules.TerminatingRule.accept(TerminatingRule.java:66) at com.sun.jersey.server.impl.uri.rules.ResourceClassRule.accept(ResourceClassRule.java:108) at com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:147) at com.sun.jersey.server.impl.uri.rules.RootResourceClassesRule.accept(RootResourceClassesRule.java:84) at com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1511) at com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1442) at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1391) at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1381) at com.sun.jersey.spi.container.servlet.WebComponent.service(WebComponent.java:416) at com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:538) at com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:716) at javax.servlet.http.HttpServlet.service(HttpServlet.java:668) at com.google.inject.servlet.ServletDefinition.doService(ServletDefinition.java:263) at com.google.inject.servlet.ServletDefinition.service(ServletDefinition.java:178) at com.google.inject.servlet.ManagedServletPipeline.service(ManagedServletPipeline.java:91) at com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:62) at com.google.inject.servlet.ManagedFilterPipeline.dispatch(ManagedFilterPipeline.java:118) at com.google.inject.servlet.GuiceFilter.doFilter(GuiceFilter.java:113) at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1676) at com.itko.lisa.invoke.AuthenFilter.doFilter(AuthenFilter.java:254) at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1668) at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:581) at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143) at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:548) at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:226) at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1180) at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:511) at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:185) at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1112) at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141) at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:213) at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:134) at org.eclipse.jetty.server.Server.handle(Server.java:524) at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:319) at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:253) at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:273) at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:95) at org.eclipse.jetty.io.SelectChannelEndPoint$2.run(SelectChannelEndPoint.java:93) at org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.executeProduceConsume(ExecuteProduceConsume.java:303) at org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.produceConsume(ExecuteProduceConsume.java:148) at org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.run(ExecuteProduceConsume.java:136) at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:671) at org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:589) at java.lang.Thread.run(Thread.java:745)

     

    please advise how to perform post call using invoke API.

     

    Note: Get calls are working as expected.



  • 4.  Re: Lisa Invoke API issue.

    Posted 03-01-2018 10:36 AM

    I tried in POSTMAN and its working as expected.

     

    Thank you,

    Venu



  • 5.  Re: Lisa Invoke API issue.

    Posted 03-01-2018 02:36 PM

    Hi Joel,

     

    as you suggested, I have tried POST and GET methods and working as expected.

    buy when I tried to set Execution mode (PUT Method) getting bad request error. Below are the request details.

    Referred document url:

    https://docops.ca.com/devtest-solutions/10-2/en/reference/rest-invoke-api/change-the-execution-mode-using-the-rest-invoke-api

     

    Example:

    http://Regitryname:1505/api/Dcm/VSEs/VSE/VirtualServiceName

     

    Request:

    <?xml version="1.0" encoding="UTF-8" standalone="yes"?>

    <VirtualService xmlns="http://www.ca.com/lisa/invoke/v2.0" name="VirtualServiceName"
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.ca.com/lisa/invoke/v2.0 VirtualService.xsd"  href="http://Regitryname:1505/api/Dcm/VSEs/VSE/VirtualServiceName"
     type="application/vnd.ca.lisaInvoke.virtualService+xml">
       
     <ExecutionMode>Transaction Tracking</ExecutionMode>

    </VirtualService>

     

    Error details:

    <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    <Error xmlns="http://www.ca.com/lisa/invoke/v2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.ca.com/lisa/invoke/v2.0 Error.xsd" type="application/vnd.ca.lisaInvoke.error+xml">
        <Id>1010</Id>
        <Message>Bad Request</Message>
        <AdditionalInformation>Error</AdditionalInformation>
    </Error>

    Please provide solution.

     

    Thanks,

    Venu



  • 6.  Re: Lisa Invoke API issue.

    Posted 03-01-2018 03:51 PM

    There may be a bug in the code or in the documentation.  I am not sure. May be best to open a ticket with CA Support.

    What did you pass in the HTTP headers? The information sent seems to be based on the response headers from:

    GET http://<registry>:1505/api/Dcm/VSEs/VSE/<serviceName>

    PUT http://<registry>:1505/api/Dcm/VSEs/VSE/<serviceName>

    http header -> ContentType = application/vnd.ca.lisaInvoke.virtualService+xml



  • 7.  Re: Lisa Invoke API issue.

    Posted 03-01-2018 04:14 PM

    I have added below details in header details.

     

    Content-Type = application/vnd.ca.lisaInvoke.virtualService+xml

     

    will open support ticket.

     

    Thanks,

    Venu