Service Virtualization

 View Only
  • 1.  How to convert substring of dynamic url parameter into upper case ?

    Posted May 19, 2023 03:17 AM

    Hi Team,

    We have a new requirement in GET virtual service they want to store the uppercase of substring of dynamic parameter. 

    Operation : GET/api/vi/678a5fvg76
     Dynamic Parameter : 678a5fvg76
    In response they want to store the substring in uppercase 



  • 2.  RE: How to convert substring of dynamic url parameter into upper case ?

    Broadcom Employee
    Posted May 19, 2023 06:50 AM
    Hi Shivani
    Please refer to this documentation on how to extracts parts of the
    request URL.

    https://techdocs.broadcom.com/us/en/ca-enterprise-software/devops/devtest-solutions/10-7/using/using-service-virtualization/service-virtualization-concepts/parsing-uris-in-http-requests.html

    Please let me know if you have any questions.

    --
    regards
    Sankar Natarajan

    --
    This electronic communication and the information and any files transmitted
    with it, or attached to it, are confidential and are intended solely for
    the use of the individual or entity to whom it is addressed and may contain
    information that is confidential, legally privileged, protected by privacy
    laws, or otherwise restricted from disclosure to anyone else. If you are
    not the intended recipient or the person responsible for delivering the
    e-mail to the intended recipient, you are hereby notified that any use,
    copying, distributing, dissemination, forwarding, printing, or copying of
    this e-mail is strictly prohibited. If you received this e-mail in error,
    please return the e-mail to the sender, delete it from your computer, and
    destroy any printed copy of it.




  • 3.  RE: How to convert substring of dynamic url parameter into upper case ?

    Posted May 19, 2023 07:17 AM

    How can we convert extracted part from the URL into upper case ?
    for the substring we use {{=request_argname.Substring(0,2)}}after using we will get 6ae but we want  this 6AE .




  • 4.  RE: How to convert substring of dynamic url parameter into upper case ?

    Broadcom Employee
    Posted May 19, 2023 07:28 AM
    You need to use the segment attributes as shown in the document. I have
    sent a detailed explanation with a sample VS in another mail.

    Attributes

    HTTP-Segment-Attr-0 = email
    HTTP-Segment-Attr-1 = notanemail@nothing.com
    HTTP-Segment-Attr-2 = hello;world=yes;goodbye=no
    HTTP-Segment-Attr-3 = ctx(someProp=someValue)
    HTTP-Segment-Attr-4 = list

    --
    regards
    Sankar Natarajan

    --
    This electronic communication and the information and any files transmitted
    with it, or attached to it, are confidential and are intended solely for
    the use of the individual or entity to whom it is addressed and may contain
    information that is confidential, legally privileged, protected by privacy
    laws, or otherwise restricted from disclosure to anyone else. If you are
    not the intended recipient or the person responsible for delivering the
    e-mail to the intended recipient, you are hereby notified that any use,
    copying, distributing, dissemination, forwarding, printing, or copying of
    this e-mail is strictly prohibited. If you received this e-mail in error,
    please return the e-mail to the sender, delete it from your computer, and
    destroy any printed copy of it.




  • 5.  RE: How to convert substring of dynamic url parameter into upper case ?

    Broadcom Employee
    Posted May 19, 2023 07:33 AM
      |   view attached

    Hi Shivani
               A MAR file has been attached herewith. Please download this file, rename it as CommunityQuestion.mar and then place this file in LISA_HOME/vseDeploy folder. Once done, a VS should come up on port 17008.

    You may just open your browser and invoke the url: http://localhost:17008/api/vi/678a5fvg76

    The VS responds with last part of URL in upper case. 

    Please go through the script step in the VSM that shows how to access parts of the request URL. 




    regards
    Sankar



    ------------------------------
    Sankar Natarajan
    Service Virtualization Product Engineering Team
    Broadcom
    ------------------------------

    Attachment(s)

    zip
    CommunityQuestion.zip   80 KB 1 version


  • 6.  RE: How to convert substring of dynamic url parameter into upper case ?

    Broadcom Employee
    Posted May 19, 2023 09:21 AM
    Hi Shivani

    You can have a script step if you want to tweak the response by using parts
    of the URL.

    Please just place the attached MAR file that has a simple VS that extracts
    the last part of the URL and then returns the UPPERCASE form of it.

    for ex: If the URL is : http://localhost:17008/api/v1/helloworld

    Then the VS returns HELLOWORLD as response.

    This is just a reference to understand how to extract parts of the URL
    using API calls. Please inspect and understand the script step in the VSM
    design.

    To deploy this MAR file, just place the MAR file in LISA_HOME/vseDeploy
    folder. The VS would start listening on port 17008.

    Please let me know if you have any questions.

    Sample output from the VS.

    [image: image.png]


    [image: image.png]

    --
    This electronic communication and the information and any files transmitted
    with it, or attached to it, are confidential and are intended solely for
    the use of the individual or entity to whom it is addressed and may contain
    information that is confidential, legally privileged, protected by privacy
    laws, or otherwise restricted from disclosure to anyone else. If you are
    not the intended recipient or the person responsible for delivering the
    e-mail to the intended recipient, you are hereby notified that any use,
    copying, distributing, dissemination, forwarding, printing, or copying of
    this e-mail is strictly prohibited. If you received this e-mail in error,
    please return the e-mail to the sender, delete it from your computer, and
    destroy any printed copy of it.




  • 7.  RE: How to convert substring of dynamic url parameter into upper case ?

    Posted Jun 02, 2023 01:42 AM

    Hi Shivani,

    Hope you were able to get the desired results. If still facing any issues, please share your observations.

    Thanks



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