Ask a Question

How to virtualize API using xml request and response

SOLVED
Sheeraz
New Contributor

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

3 REPLIES 3
mattb
Staff

What types of requests are you using? Rest?


If so;
You could use the parameter dispatch style to check if a parameter has a certain value, then to dispatch a matching response. 

https://support.smartbear.com/readyapi/docs/virtualization/configure/dispatch/parameter.html

 

 

Sheeraz
New Contributor

I am using soap request and response.

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

cancel
Showing results for 
Search instead for 
Did you mean: