How to virtualize a web service whose request and response pair are of different format

Document ID : KB000095760
Last Modified Date : 14/05/2018
Show Technical Document Details
Issue:
The request data comes as String parameter over HTTP and the response is sent back as XML data protocol over HTTP. How to virtualize this functionality.

Below are the sample request and response
Request: [Test=XX] [ProdId=yutr] [TestID=9876] [NA=12.XX.XX3] [VALT=XX.XX.X.XX] [TS=20183]
Response : Any XML response
Environment:
Supported DevTest Environments.
Cause:
HTTP request is not in XML or in JSON but in String so need to customize it create a VS.
Resolution:
Created VS with RR Pairs option as below. 
. Provided the VSI and VSM names. 
. Configured the Protocol information. 
. REST DPH is automatically added. 
. Added Scriptable DPH and Delimited Text DPH. 
. Added the below code to modify the request to have delimiter as "] [" in Scriptable DPH: 
------- 
%beanshell% 
import com.itko.util.ParameterList; 
// Manipulate request body text 
String theBody = lisa_vse_request.getBodyText(); 
String NewBody = theBody.substring(1,theBody.length()-1); 
-------- 
. Configured Delimited Text Data Protocol with Name/Value pairs as "[]" 
. With the above DPH's, request is parsed with the below arguments and VS is created without any issue. Test=XX,ProdId=yutr,TestID=9876,NA=12.XX.XX3,VALT=XX.XX.X.XX,TS=20183