Validate IDs and throw error if invalid ID.

Hi,

I have a requirement where i need to validate IDs and throw error if invalid. I have created data source and added available IDs. I have created one request and assigned data source to it. I am passing two parameters in my responder. I tried to execute but i am not successful in throwing error.

ex:-
Created Data Source and added column as IDs:-
111111111111111111111
222222222222
333333333333

Responder - Check-InvalidIDs
Parameters:-
ID and date.

message: Invalid ID and status code is 400.

Note:- I don't have a logic code to check for IDs so i just added one data source and attached it to responder. Can i achieve this with my scenario?

Tagged:

Comments

  • williammccuskerwilliammccusker Posts: 365 ✭✭

    Hi,
    It sounds like what might work is a setup with two responders. The first responder has a data source correlation setup for that requests that match IDs in the data source get a good, 200 ok, response. Then after that responder would be a second responder configured with the 400 response. For this to work you'll want the first responder to have the "Continue searching for a matching responder if data source correlation fails" option enabled.

    Here is a link to documentation about the correlation process
    https://docs.parasoft.com/display/VIRT9106/Understanding+the+Message+Correlation+Process

  • jithenderreddyjithenderreddy Posts: 73

    Thank You. I will try the scenario and let you know.

  • jithenderreddyjithenderreddy Posts: 73

    Thank You. I tried the scenario but i am not able to see the error message for invalid ID. Are below correct step?:

    Responder - Check-validIDs
    Attached data source with valid IDs.
    Parameters:- ID and date.
    "Continue searching for a matching responder if data source correlation fails" option enabled.
    200 OK

    Responder - invalidIDs
    Parameters:- ID and date.
    configured with the 400 response.

  • williammccuskerwilliammccusker Posts: 365 ✭✭

    Hi,

    Yes that looks correct, when you send an invalid id what do you see? Are the invalid in the data source? What values are you sending for an invalid id?

  • jithenderreddyjithenderreddy Posts: 73

    Thank You. I have valid IDs in the data source. I do not have any data source for invalid. Currently i am passing any value for invalid. Do you think this approach should work? or should i need any think additional to work?

  • williammccuskerwilliammccusker Posts: 365 ✭✭

    Hi,

    Yes the approach should work. Have you tried removing all correlation settings from the invalid Ids responder? In your case anything that gets pasted the first responder should be considered in valid. The correlation on the ID and date parameters would require both those parameters to be present for the responder to match.

Sign In or Register to comment.