Forum Discussion

Sheeraz's avatar
Sheeraz
New Contributor
3 years ago

How to virtualize API using xml request and response

Hi Team,

I am new to readyAPI, looking for API virtualization using xmls.

I have a set of request and response, in a single API I want to get response by looking at the particular argument value. Likewise, if a selected argument value matches it should return the specific response accordingly.

For example in my request will be having an argument called <policy number>12345</policy number>

I have multiple policy number with specific responses each.

 

Could you please help how can we achieve this requirement using ReadyAPI, it would be really helpful if i get some steps.

 

Thanks,

Sheeraz

  • The Parameter dispatch setting is available for REST virtual services only. So, unfortunately we can't use this approach here. 

    What we could do is use a script to implement our logic to dispatch the results in a groovy script. Something like a switch statement could help you out here. This is a good resource if you're not familiar with scripting: https://www.tutorialspoint.com/groovy/groovy_switch_statement.htm

    I would also advise downloading the SOAP sample project as it contains a SOAP virtual API that uses a script to dispatch responses. You can download this under the sample projects under your dashboard tab. If you're having trouble finding this project you can click here for more instructions on where to find it. https://support.smartbear.com/readyapi/docs/functional/tutorial/samples.html