Service Virtualization

  • 1.  Way to set non-http standard code like 701, 702 etc.

    Posted Jun 06, 2016 04:07 PM

    Hi All,

    I have recorded a transaction which is sending non-standard http code as 701 and 702 etc. When I deploy my virtual service and trying to access it using DevTest testcase, it is throwing error as org.apache.http.NoHttpResponseException. It seems Virtual HTTP/S Responder step is VSM causing this problem by validating HTTP response headers.

     

    ============================================================================
    | java.lang.RuntimeException: The response object is not formed properly. It is missing the response code meta data entry or it is invalid: code=701
    ============================================================================
    | Step: Virtual HTTPS Responder
    ----------------------------------------------------------------------------
    | Message: The response object is not formed properly. It is missing the response code meta data entry or it is invalid: code=701
    ----------------------------------------------------------------------------
    | Trapped Exception: The response object is not formed properly. It is missing the response code meta data entry or it is invalid: code=701
    | Trapped Message: java.lang.RuntimeException: The response object is not formed properly. It is missing the response code meta data entry or it is invalid: code=701
    ----------------------------------------------------------------------------
    STACK TRACE
    java.lang.RuntimeException: The response object is not formed properly. It is missing the response code meta data entry or it is invalid: code=701
    at com.itko.lisa.vse.stateful.protocol.http.HttpRespondStep.setResponseInfo(HttpRespondStep.java:310)
    at com.itko.lisa.vse.stateful.protocol.http.HttpRespondStep.setupResponseInfoHeaderAndContent(HttpRespondStep.java:174)
    at com.itko.lisa.vse.stateful.protocol.http.HttpRespondStep.respond(HttpRespondStep.java:125)
    at com.itko.lisa.vse.stateful.BaseRespondStep.execute(BaseRespondStep.java:231)
    at com.itko.lisa.test.TestNode.executeNode(TestNode.java:981)
    at com.itko.lisa.test.TestCase.execute(TestCase.java:1295)
    at com.itko.lisa.test.TestCase.execute(TestCase.java:1210)
    at com.itko.lisa.test.TestCase.executeNextNode(TestCase.java:1195)
    at com.itko.lisa.test.TestCase.executeTest(TestCase.java:1136)
    at com.itko.lisa.coordinator.Instance.run(Instance.java:204)

    ============================================================================

     

    Thanks.



  • 2.  Re: Way to set non-http standard code like 701, 702 etc.
    Best Answer

    Broadcom Employee
    Posted Jun 06, 2016 04:54 PM

    If you are on DevTest 8.3 or above, you can set the following property in your local.properties file to enable non standard Http response codes.

     

    lisa.vse.http.response.allowNonStandardResponseCode=true

     

    https://docops.ca.com/devtest-solutions/8-3/en/reference/property-descriptions/custom-property-files/local-properties-file



  • 3.  Re: Way to set non-http standard code like 701, 702 etc.

    Posted Jun 06, 2016 04:57 PM

    Thanks a lot Prem. I set this property in "Execute Script (JSR-223)" step and its working !!

     

    testExec.setStateObject("lisa.vse.http.response.allowNonStandardResponseCode", true);



  • 4.  Re: Way to set non-http standard code like 701, 702 etc.

    Broadcom Employee
    Posted Jun 06, 2016 05:01 PM

    You will need to try it out - assuming your JSR-223 step is before the respond step.

     

    Another thing you can try is setting this property value to true using a config file.