Ask a Question

How to turn xml string in a REST request parameter in SOAPUI OS Edition

SOLVED
dmeilhac
New Contributor

How to turn xml string in a REST request parameter in SOAPUI OS Edition

Hello, 

I feel like my question is soooo easy to answer, but I could'nt find any answer after a 2hours search on the web.

I have a POST request on a REST endpoint. This request only have 1 parameter, the value of this parameter is an xml string. 

It works well when I put the xml string in the value field. I get a normal xml response as expected. 

But the value field is not easy to read when the xml string is quite long. So I intend to put the xml string below in the xml/text media Type Field and put the reference to this string in the value of the parameter. 

 

The question is : what reference should I input in the value field to let it be replaced by the xml string below ? 

I check the xml version of my SOAPUI projet and could see that the xml string is in the <con:request> tag. 

I feel like I should have to input something like $request or ${request} but it does not work. 

 

Please see the screenshot to get a better understanding (I took the screenshot with the www-form-urlencoded value but I tried text/aml and application/xml with no success)

 

Thanks in advance

 

DnF3T7T7m6.png

2 REPLIES 2
richie
Community Hero

Hey @dmeilhac 

 

you have the postquerystring checkbox ticked - this means that if your URI is '/resource-name?param1=value1&param2=value2' (so you have two QUERY type parms setup on the request, instead of them appearing in your request's URI, you can move them to the payload field).

 

I don't think your XML payload is supposed to map to a QUERY parameter on your request.  Either something else is (a different parameter value) or none at all Im guessing.  Youve blanked out the request's host and URI in the screenshot so I cant see whats going on.  For security considerations, all you need to do is blank out the host.

 

So if you have a request with full URL of

https://myserver.com/resource-name?param1=value1&param2=value2

 

the only bit you need to blank out is the host bit '//myserver.com'

 

Can you show the URI (the bit AFTER the host) so we can see what your QUERY parms look like?  Then we'd be able to see what's going on.  Obviously I don't know what PARMS you do have in your URI, but looking at the scrubbed/blanked bit - it doesnt actually look like you have any QUERY parms, so at this point, without knowing anything else Id remove the QUERY parm completely (or set it to PLAIN so it isn't used).

 

Have a look at this link as this explains things quite well

 

cheers,

 

rich

 

 

if this helped answer the post, could you please mark it as 'solved'? Also if you consider whether the title of your post is relevant? Perhaps if the post is solved, it might make sense to update the Subject header field of the post to something more descriptive? This will help people when searching for problems. Ta

Dear Richie

thanks for your quick reply. Your answer + link took me to test things and one of them finally worked ! 

I don't understand how it works but it works exactly as I expected. 

Here is the screenshot to my configuration (I only blurred the host as requested). 

Thanks to you

 

dmeilhac_0-1603178894256.png

 

cancel
Showing results for 
Search instead for 
Did you mean: