Creating VS with mandatory and optional fields

Document ID : KB000095605
Last Modified Date : 17/05/2018
Show Technical Document Details
Introduction:
If a Request has 10 arguments and only 2 or 3 arguments are mandatory and rest of them are optional how a VS can be created.
Background:
If a Request has 10 arguments and only 2 or 3 arguments are mandatory and rest of them are optional how a VS can be created.

For Example: In the below XML, "line2 can be optional argument and VS should work if "line2" is there in the request or not.
<?xml version="1.0" encoding="utf-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xs="http://www.w3.org/2001/XMLSchema">
  <soapenv:Body>
    <addAddress xmlns="http://ejb3.examples.itko.com/">
      <username xmlns="">{{=%beanshell% com.ca.sv.devtest.util.GenerateString.forRegex("[A-Za-z0-9]{5,15}");}}</username>
       <addressObject xmlns="">
        <city>{{=%beanshell% com.ca.sv.devtest.util.GenerateString.forRegex("[A-Za-z0-9]{5,15}");}}</city>
        <id>{{=%beanshell% com.ca.sv.devtest.util.GenerateString.forRegex("[A-Za-z0-9]{5,15}");}}</id>
        <line1>{{=%beanshell% com.ca.sv.devtest.util.GenerateString.forRegex("[A-Za-z0-9]{5,15}");}}</line1>
        <line2>{{=%beanshell% com.ca.sv.devtest.util.GenerateString.forRegex("[A-Za-z0-9]{5,15}");}}</line2>
        <state>{{=%beanshell% com.ca.sv.devtest.util.GenerateString.forRegex("[A-Za-z0-9]{5,15}");}}</state>
        <zip>{{=[:zip:1]}}</zip>
      </addressObject>
    </addAddress>
  </soapenv:Body>
</soapenv:Envelope>
Environment:
DevTest supported environments.
Instructions:
VS can be created with mandatory and optional arguments using Request Data Manager DPH.
Additional Information:
Documentation on the Request Data Manager DPH is available at https://docops.ca.com/devtest-solutions/10-3/en/using/using-ca-service-virtualization/using-devtest-workstation-with-ca-service-virtualization/creating-service-images/using-data-protocols/request-data-manager-data-protocol.