Service Virtualization

 View Only
Expand all | Collapse all

Matching request having GS and FS character in virtual service

  • 1.  Matching request having GS and FS character in virtual service

    Posted Sep 15, 2020 03:47 PM
    ​Hello All,

    I need  to create a virtual service  where  the  incoming request  is having GS and  FS char ( group separator and File Separator) in request  message. I need to compare complete request text in the VS. I used Request Data manager and tried to create request body as argument, but it is giving me error in VSI as Character reference "&#29" is an invalid XML character.

    Can you please help me with what would be best data protocol to handle this scenario?

    Please let me know if any further information is required.

    Thanks
    Ekta


  • 2.  RE: Matching request having GS and FS character in virtual service

    Broadcom Employee
    Posted Sep 15, 2020 03:57 PM
    Ekta,  is it possible to attach a sample Req/Resp pairs to this post.  I will try to see what protocols we can use. 
    if not, please open a ticket with Broadcom support.  

    thanks

    Shiney 



  • 3.  RE: Matching request having GS and FS character in virtual service

    Posted Sep 15, 2020 04:48 PM
    ​Attaching a sample request for your reference



  • 4.  RE: Matching request having GS and FS character in virtual service

    Posted Sep 16, 2020 05:11 AM
    Hi Ekta,

    Could you please share above in a text file ?

    Thanks

    ------------------------------
    Regards,
    Vaibhav Jain
    Capgemini
    ------------------------------



  • 5.  RE: Matching request having GS and FS character in virtual service

    Posted Sep 16, 2020 06:19 AM
      |   view attached
    ​Attached request

    Attachment(s)

    txt
    subset_req.txt   24 B 1 version


  • 6.  RE: Matching request having GS and FS character in virtual service

    Broadcom Employee
    Posted Sep 16, 2020 01:19 PM
    You will probably have to write a scriptable DPH to handle this. The GS and FS characters are control codes and therefore not valid XML 1.0 characters so the Delimited Text Data Protocol won't work with those characters, I got an error due to the control character. Try a script that replaces the GS with  "|" and maybe FS with "\n" then you can use the Delimited Text Data Protocol.



  • 7.  RE: Matching request having GS and FS character in virtual service
    Best Answer

    Posted Sep 16, 2020 04:53 PM
    Edited by Christopher Hackett Sep 18, 2020 05:59 PM
    Hi Ekta,

    You can use Scriptable data protocol to replace the values as below, followed by Delimited Text Data Protocol 

    You can also use an additional RDM protocol to set the operation if needed.

    Thanks


    ------------------------------
    Regards,
    Vaibhav Jain
    Capgemini
    ------------------------------



  • 8.  RE: Matching request having GS and FS character in virtual service

    Posted Sep 22, 2020 06:05 PM
    ​Thanks all for Response. As suggested here I am trying to add Scriptable DPH but I am not seeing the changes in the request.

    I am creating MQ service and in lisa.vse.request body is showing as null.

    I have used RDM protocol to create argument(body) for the message coming in queue and argument is getting created in VSI for message

    I tried doing replace Request Body and replace in argument. But I am not seeing changes by either of the approach. ( for testing purpose I tried replacing a character of request)

    I have used below code for request Body

    String theBody = lisa_vse_request.getBodyText();

    theBody.replace('X','Z')

    lisa_vse_request.setBodyText(theBody);


    This gives me warning

    Did not get a valid Request object so we ignore processing this transaction.

    java.lang.NullPointerException

                    at bsh.ParseException.getErrorLineNumber(ParseException.java:276)


    To replace Argument text below code is used

    ParameterList args = lisa_vse_request.getArguments();

    System.out.println("-------------------------------------------");

    System.out.println(args.get("body"));

    args.get("body").replace('X','Z');

    lisa_vse_request.setArguments(args);

    System.out.println("*************************************");

    System.out.println(lisa_vse_request.getArguments());

    But I am not seeing changes in request/argument text

    Please help me to figure out what I am doing wrong here.

    Thanks
    Ekta





  • 9.  RE: Matching request having GS and FS character in virtual service

    Posted Sep 23, 2020 01:08 AM
    Hi Ekta,

    I was able to process the message shared by you using below script:

    Please try the same exact script once.
    If you still face similar issue, please share the vsi & vsm.

    Thanks


    ------------------------------
    Regards,
    Vaibhav Jain
    Capgemini
    ------------------------------



  • 10.  RE: Matching request having GS and FS character in virtual service

    Posted Sep 30, 2020 02:03 PM
    It worked. I had to create a new model. I was getting error while editing existing model.

    Thank you everyone for response ​


  • 11.  RE: Matching request having GS and FS character in virtual service

    Posted Sep 30, 2020 02:35 PM
    Thanks for the update Ekta.

    ------------------------------
    Regards,
    Vaibhav Jain
    Capgemini
    ------------------------------