search cancel

Need help with response metadata parameterization

book

Article ID: 140718

calendar_today

Updated On:

Products

CA Cloud Test Mobile CA Application Test Service Virtualization

Issue/Introduction

Creating a REST service with parameterized response. Getting all required values in the VSM.

Trying to parameterize the http response code in the response metadata section in the VSI.

tried below values for Key : HTTP-Response-Code

Value : {{=ResponseCode}}

Value : {{=ResponseCode;/*200*/}}

 

Getting below error in the respond step while unit testing:

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

| java.lang.RuntimeException: The response object is not formed properly.  It is missing the response code meta data entry or it is invalid: code= 200

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

| Step:        HTTP/S Respond

----------------------------------------------------------------------------

| Message:     The response object is not formed properly.  It is missing the response code meta data entry or it is invalid: code= 200

----------------------------------------------------------------------------

| Trapped Exception: The response object is not formed properly.  It is missing the response code meta data entry or it is invalid: code= 200

| 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= 200

----------------------------------------------------------------------------

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= 200

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:187)

at com.itko.lisa.vse.stateful.protocol.http.HttpRespondStep.respond(HttpRespondStep.java:130)

at com.itko.lisa.vse.stateful.BaseRespondStep.execute(BaseRespondStep.java:231)

at com.itko.lisa.test.TestNode.executeNode(TestNode.java:984)

at com.itko.lisa.test.TestCase.execute(TestCase.java:1297)

at com.itko.lisa.test.TestCase.execute(TestCase.java:1198)

at com.itko.lisa.test.TestCase.executeNextNode(TestCase.java:1183)

at com.itko.lisa.editor.WalkThruPanel.prepAndExecNode(WalkThruPanel.java:1115)

at com.itko.lisa.editor.WalkThruPanel.access$900(WalkThruPanel.java:73)

at com.itko.lisa.editor.WalkThruPanel$10.doCallback(WalkThruPanel.java:1017)

at com.itko.util.swing.panels.ProcessingDialog$2.run(ProcessingDialog.java:195)

at java.lang.Thread.run(Thread.java:745)

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

Cause

N/A

Environment

All supported DevTest releases.

Resolution

Can not use Devtest property directly in virtual service header section. 

Create Scriptable protocol filter which will be executed during playback mode and update HTTP-Response-Code with response code which you want to modify.