Service Creation using RR Pairs (Request/Response Pairs)

Service Virtualization allows you to create service using request/response(RR) pairs that contain information in the form of HTTP headers and body. It is convenient to use when your backend server is under development and you don't have recording setup, however you have request-response pairs of that backend.

RR pair consists of one request and one or more responses that follow the below naming conventions:

An example of a REST request file:

POST /api/v2/merchants/payment HTTP/1.1
Accept: application/json
Content-Type: application/json
Content-Length:216

{
  "amount": {
    "amount": 10.5,
    "currency": "USD"
  },
  "paymentMethod": "wallet",
  "PayPalWallet": {
    "Balance": 956.23,
    "WalletID": "UX876QAC"
  },
  "transactionChannel": "Web Online"
}

In case of SOAP request, request file can have only payload. (see note for more detail). An example of a SOAP request file:

POST /loyalty/loyaltyservice/v1 HTTP/1.1
Content-Type: application/soap+xml; charset=utf-8
Content-Length:479

<?xml version="1.0" encoding="UTF-8"?>
<soap:Envelope>
   <soap:Header>
      <v1:request_header>
         <v11:requesterName>POS</v11:requesterName>
         <v11:requestDate>2013-05-09</v11:requestDate>
      </v1:request_header>
   </soap:Header>
   <soap:Body>
      <v1:searchRewards>
         <v11:provider>cavisson</v11:provider>
         <v11:emailAddress>perfemail1@cavisson.com</v11:emailAddress>
      </v1:searchRewards>
   </soap:Body>
</soap:Envelope>

Similarly, a response file consists of following sections:

An example of a response file:

HTTP/1.1 200 OK

{
  "orderAmount": 10.5,
  "currency": "USD",
  "completable": true,
  "timestamp": "04-15-22/03:05",
  "transactionReferences": [
    {
      "transactionId": 3495717101571,
      "transactionType": "InitiateDebit",
      "transactionDate": "04-15-22/03:05",
      "transactionDesc": "Transaction Accepted",
      "status": "Processed",
      "paymentMethod": "PayPal"
    }
  ]
}

An example of a SOAP response file:

HTTP/1.1 200 OK

<?xml version="1.0" encoding="UTF-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
   <soap:Body>
      <searchRewardsResponse xmlns="http://service.cavisson.com/Loyalty/
LoyaltyService/v1" xmlns:ns1="http://schema.cavisson.com/
Loyalty/LoyaltyData/v1">
         <ns1:returnCode>0</ns1:returnCode>
         <ns1:accounts>
            <ns1:account>
               <ns1:membershipIdentifier>
                  <ns1:provider>cavisson</ns1:provider>
                  <ns1:identifier>841010</ns1:identifier>
               </ns1:membershipIdentifier>
               <ns1:emailAddress>
                  <ns1:emailAddress>perfemail1@cavisson.com</ns1:emailAddress>
               </ns1:emailAddress>
               <ns1:loyaltyCardFlag>false</ns1:loyaltyCardFlag>
               <ns1:tier>BASE</ns1:tier>
               <ns1:member>
                  <ns1:phoneNumbers>
                     <ns1:phoneNumber>
                        <ns1:phone>1306295190</ns1:phone>
                        <ns1:type>HOME</ns1:type>
                     </ns1:phoneNumber>
                  </ns1:phoneNumbers>
               </ns1:member>
            </ns1:account>
         </ns1:accounts>
      </searchRewardsResponse>
   </soap:Body>
</soap:Envelope>

How to Create a Virtual Service Using RR Pairs?

  1. A user can select RR files by "Using Files" or directory having RR pairs by "Using Directory" radio button.
  2. Next upload selected RR pairs by clicking on "Upload". Once uploaded, the user can see the all request/response pair(s) in "Captured URL List". Selected pair is displayed in lower section wherein Request displays the request header and its payload while Request payload displays the request payload. Similarly, Response displays the response header with its payload while Response Payload displays the response payload.
  3. If the user wants to reset the table data, click "Reset".
  4. Next click on the "Create Services" which will only create the service while "Create Service and Activate" will create the service and activate the service virtualization server also.

Note:

  1. The service name will be created by file name however it is editable, the user needs to click the name and edit it.
  2. In case SOAP request does not have a request line then service is created with service url " /cav_soap_service". And other services without request line are added as template in same service.
  3. While creating service, service virtualization server does auto correlation i.e. it automatically detects the value in response that matches in the request and replace those values with parameters.