Need help with response metadata parameterization

book

Article ID: 140718

calendar_today

Updated On:

Products

CLOUDTEST CA Application Test CA Cloud Test Mobile MOBILECLOUD Service Virtualization

Issue/Introduction

I am creating a REST service with parameterized response. I'm getting all required values in the VSM.

I'm 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*/}}

 

I'm 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)

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

Environment

Release : 10.3

Component : CA Service Virtualization

Resolution

We can not use Devtest property directly in virtual service header section. 

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