Ask a Question

How to get data requested from request body retrieve data from DataSource in service virtualization

sivajcet530
Occasional Visitor

How to get data requested from request body retrieve data from DataSource in service virtualization

1. Send accountNumber in request body.

2. Create database table with accountNumber, Name, Address

3. I created a script to read the data from request body and placed it in OnRequest Script

def reqString = mockRequest.getRequestContent()
def inputAccNo= reqString .substring(22)
log.info inputAccNo

4. Created connection to the table created in step2 in "Data Sources" table in Ready API (Virtual) service.

Could you please help how to pass the inputAccNo to get appropriate data (accountNumber, Name, Address) from data source?

If I send inputAccNo 10001 it should give response as 10001,XNAME,XADDRESS, If I send 1002 it should get data from DB and give response as 10002,YNAME,YADDRESS

0 REPLIES 0
cancel
Showing results for 
Search instead for 
Did you mean: