Service Virtualization

  • 1.  Read values from Request URL (PARAM)

    Posted Mar 22, 2018 12:44 AM

    Hi, My incoming request looks like below. 

    http://server:port/its/data/plans/planid1234/versions/versionid1234/assets/investment?accountId=4444

     

    I will need to retrieve PLAN ID (planid1234), Version ID (versionif1234) and account id(4444) from the Request URL. 

     

    I tried RegEx [A-Za-z][A-Za-z0-9\+\.\-\?]* while recording and my URI Rules look like below but only retrieves Plan ID and Version id. Doesn't retrieve Account ID.. Please advice

     

    GET /its/data/{URLPARAM0}/{URLPARAM1}/{URLPARAM2}/{URLPARAM3}/{URLPARAM4}/{URLPARAM5}/


  • 2.  Re: Read values from Request URL (PARAM)
    Best Answer

    Posted Mar 22, 2018 08:49 AM

    I believe you should reset the URI rules. You should be able to parse this URI OOTB.

    GET /its/data/plans/{URLPARAM0}/versions/{URLPARAM1}/assets/investment is the URI.

     

    When the REST parser parses the request the following Argument List entries should feed into the VSI:

    URLPARAM0 = planid1234

    URLPARAM1 = versionid1234

    accountId = 4444

    The Rest DPH parses the {URLPARAM...} values and creates arguments in the transaction's argument list.

    The Query String (?accountId=4444) is processed OOTB and is not part of the URI in terms of URLPARAM... definition and parsing.



  • 3.  RE: Re: Read values from Request URL (PARAM)

    Posted May 29, 2020 11:00 AM
    Edited by SKavitha May 29, 2020 11:05 AM
    ​Even we have the same scenario:

    GET /servicedata/app/v1/life/80000001/vendorreports/ -> something like this,

    When I tried the above with RR pair,  it gives the URI as "/servicedata/app/v1/life/{URLPARAM0}/vendorreports/".

    When I run through SOAP, it s not taking the run time value for {URLPARAM0}. It says URL not found. Its taking only the value "80000001" which was passed in the base path in listener step and not anything else.

    Can you guide me?


  • 4.  RE: Re: Read values from Request URL (PARAM)

    Broadcom Employee
    Posted May 29, 2020 11:22 AM
    Hi Kavitha,

    Verify the base path in your VSM-->HTTP Listen step. Guessing may be it might have a hard coded value "/servicedata/app/v1/life/{URLPARAM0}/vendorreports/".

    You can have the base path like "/servicedata/app/v1/life/" and the REST DPH should have the URI rule as "/servicedata/app/v1/life/{URLPARAM0}/vendorreports/" and VSI should have the Operation as"/servicedata/app/v1/life/{URLPARAM0}/vendorreports/".

    Try the above and if you still see the issue, open a support ticket and support can help you.

    Prema



  • 5.  RE: Re: Read values from Request URL (PARAM)

    Posted May 30, 2020 02:04 AM
    Hi Kavitha,

    When you create a service using R-R pair for below request:
    GET /servicedata/app/v1/life/80000001/vendorreports/ 

    The base path of service is default set as :   /servicedata/app/v1/life/80000001/vendorreports/ 
    and the operation in vsi will be GET /servicedata/app/v1/life/{URLPARAM0}/vendorreports/

    Please note that as your basepath is having 80000001 in it, it won't work for any other value. Hence, you have to update it to  " /servicedata/app/v1/life/"

    Thanks

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



  • 6.  RE: Re: Read values from Request URL (PARAM)

    Posted May 30, 2020 02:22 PM
    ​Hi Vaibhav,

    Even I have the same issue. My vsm base path has no hard coded value. its has the same path as vsi file.

    But still when executing via SOAP , I'm getting URL not found.

    The base path of service is set as :   /servicedata/app/v1/life/{URLPARAM0}/vendorreports/
    and the operation in vsi will be GET /servicedata/app/v1/life/{URLPARAM0}/vendorreports/

    Regards,
    Geetha R


  • 7.  RE: Re: Read values from Request URL (PARAM)

    Posted May 30, 2020 02:52 PM
    Hi Geetha,

    Your service's base path should be "/servicedata/app/v1/life/" instead of "/servicedata/app/v1/life/{URLPARAM0}/vendorreports/". Modify it accordingly and test. It works as i have implemented this kind of scenarios earlier.

    Operation in vsi should be GET /servicedata/app/v1/life/{URLPARAM0}/vendorreports/

    Thanks.


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



  • 8.  RE: Re: Read values from Request URL (PARAM)

    Posted Jun 02, 2020 10:53 AM
    Thanks Vaibhav it worked !