We have 4 JSON request/response in service virtualization, some extra field in both request/response are present this will be executed in same endpoint and values of the request/response are not same always so we need to add scripted rule.

we have 4 provide flows and all of them will be executed from one endpoint so we need to use same scripted rule as we have to add logic if request a is getting hit the response a should be executed. but in this case we are unable to give if condition or try catch. as we are trying to give condition with path which is extra to make it unique the basic request is giving null reference error.

  • tags which are present request 1 :-

{
"action": "add",
"productOffering": {
"id": "VF_MODEM",
"name": "VF Modem"
},
"attributes": [
{
"name": "MODEL_NAME",
"value": "GigaBox Modem"
}
]
}

  • tags which are present request 2 :-

{
"action": "add",
"productOffering": {
"id": "VF_MODEM",
"name": "VF Modem"
},
"attributes": {
"name": "MODEL_NAME",
"value": "GigaBox Modem"
}
},
{
"action": "add",
"productOffering": {
"id": "VF_PRIMARY_STB",
"name": "VF Primary STB"
},
"attributes": {
"name": "MODEL_NAME",
"value": "Primary Android STB"
}
}

  • tags which are present request 3 :-

{

"action": "add",
"productOffering": {
"id": "VF_MODEM",
"name": "VF Modem"
},
"attributes": {
"name": "MODEL_NAME",
"value": "GigaBox Modem"
}
},
{
"action": "add",
"productOffering": {
"id": "VF_VOIP_VOB",
"name": "VF VoIP/VOB"
}

  • tags which are present request 4:-{
    "action": "add",
    "productOffering": {
    "id": "VF_MODEM",
    "name": "VF Modem"
    },
    "attributes": {
    "name": "MODEL_NAME",
    "value": "GigaBox Modem"
    }
    },
    {
    "action": "add",
    "productOffering": {
    "id": "VF_PRIMARY_STB",
    "name": "VF Primary STB"
    },
    "attributes": {
    "name": "MODEL_NAME",
    "value": "Primary Android STB"
    }
    },
    {
    "action": "add",
    "productOffering": {
    "id": "VF_VOIP_VOB",
    "name": "VF VoIP/VOB"
    }
    },