The behavior to divide the arguments from the request side for HTTP(S) virtual service's record/playback was changed in 8.2. And sometimes old test cases, old client applications and vse services cannot be used.

Document ID : KB000037298
Last Modified Date : 14/02/2018
Show Technical Document Details
Introduction:

Symptoms:
A bug fix for the Virtual Service Environment(VSE) in DevTest 8.2 changed the behavior to divide the arguments from the request side for HTTP(S) virtual service's recording/playback.

In the release note of DevTest 8.2, we can find the sentence in the "CA Service Virtualization Enhancements":
Fixed incorrect evaluation of Key value pairs when request body has an "=" in it.

Because of this bug fix, the condition to divide the arguments from the request side for HTTP(S) virtual service's record/playback was changed.
1. Before Bug Fix:
   If the request body includes the "=", then the recorder and virtual service always divide the arguments from the request body.
2. After Bug Fix:
   If the request body includes the "=" but the header does not include the suitable "Content-type", then the recorder and virtual service do not divide the arguments.
   But if the request body includes the "=" and the header includes "Content-type: application/x-www-form-urlencoded", then the recorder and virtual service always divide the arguments from the request body.

 

Environment:
But for this bug fix, there are some possibilities to change the request header for the test case(or client application to send a request), because there are some possibilities that old implementations included bad behavior.
So some requests from the client application cannot get the suitable response from the virtual services, because the client application uses the bug for DevTest 8.1 or lower.
This problem does not have platform and OS dependencies but has the configuration/implementation dependencies.

 

 

Resolution:
1. Formal resolution
So the formal resolution for this phenomenon is to add the
"Content-type: application/x-www-form-urlencoded"
in the header of the HTTP request like:
Before:
---------------------------------------------------------------------
POST <Base Path> HTTP/1.1

<Body Information>
---------------------------------------------------------------------
After:
---------------------------------------------------------------------
POST <Base Path> HTTP/1.1
Content-type: application/x-www-form-urlencoded

<Body Information>
---------------------------------------------------------------------

2. Temporary workaround
However, if the client application cannot be changed so quickly(Example. because it is very complicated), then the customer needs temporary solution which needs to apply during waiting time for changes of the client application.
If we can define this condition:
a. the body of the request always has the format like
key1=value1&key2=value2&...
style only, then we can create a temporary workaround to create the Scriptable data protocol filter for the "Process Requests" in the "Virtual HTTP(S) listener <Port number>" step like:

---------------------------------------------------------------------
%beanshell%

import com.itko.util.ParameterList;
String theBody = lisa_vse_request.getBodyText();

// If you want to delete the blank, the return code... from the body text, then please write a code here
// These three lines are sample, if you do not need then please commented out
theBody=theBody.replaceAll(" ", "");
theBody=theBody.replaceAll("\r", "");
theBody=theBody.replaceAll("\n", "");

ParameterList p = new ParameterList();
// Based on the condition the format of body is only Key1=Value1&Key2=Value2&Key3=Value3... style, so can be inserted to parameters.
p.addParameters(theBody);

lisa_vse_request.setArguments(p);

p.clear();
---------------------------------------------------------------------
Screenshot for the "Virtual HTTP(S) listener <Port number>" step and the Scriptable data protocol for the "Process Requests".

Scriptable.jpg

 

Instructions:
Please Update This Required Field