AnsweredAssumed Answered

Scriptable Data Protocol error

Question asked by Rajarajan.G.Kiruba on Jul 25, 2018
Latest reply on Jul 26, 2018 by Rajarajan.G.Kiruba

I am trying to retrieve a 16 digit card number from one of the incoming argument then create and assign the 16 digit cardnumber to a new argument for matching in VSI.  But i am getting error while trying to create the service using the below code. Any suggestion is appreciated.

 

%beanshell%

import com.itko.util.ParameterList;
import com.itko.lisa.vse.stateful.model.Request;
import java.util.regex.Pattern;
import java.util.regex.Matcher;

// Arguments, Attributes, and Metadata are all ParameterList

ParameterList args = lisa_vse_request.getArguments();
String INPUT = args.get("systemContext_correlationId");
String REGEX = "\\d{16}+";
int iStart, iEnd;
String CardNumber;

Pattern p = Pattern.compile(REGEX);

// get a matcher object
Matcher m = p.matcher(INPUT);

while(m.find()) {
iStart = m.start(); // Set the start position
iEnd = m.end(); // Set the end position
CardNumber = INPUT.substring(iStart,iEnd);
break; // Exit from the while loop after first occurance of the given regex pattern
}

args.addParameter(new Parameter("CardNumber", "CardNumber", CardNumber));

lisa_vse_request.setArguments(args);

Outcomes