Forum Discussion

tslosar's avatar
tslosar
Contributor
10 years ago

Migrating a project from SoapUI 5.0.0 to PRO

Hello SoapUI Pro Support,
While migrating a project from MockService from SoapUI 5.0.0 to the most recent version of SoapUI Pro we were no longer able to retrieve POST form submission input values using groovy script.
Can you please email us a groovy script code example that will retrieve the country, language and xml-structure input parameters from the form below?
Thank you- we are working on an urgent project for an important client and this will be most helpful.
Best- Tony


==============code that worked in SoapUI 5.0.0 but no longer works in 5.1 Pro. A null value is now returned for all parameters=================
//syntax for retrieving input parameters form/value pair from form POST submission
def Country = mockRequest.getRequest().getParameter("country")
log.info Country


def Language = mockRequest.getRequest().getParameter("language")
log.info Language
def currentXMLPayload = mockRequest.getRequest().getParameter("xml-structure")
log.info currentXMLPayload


====Form POST (can copy to .txt document, then change the file extension to .html to run against a test mock service)
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>Test Form</title>
</head>
<body>
<h1>DMS RO Creation</h1>
<form method="POST" action="http://localhost:8082/dro/dms_create_ro.do?process=create">
<p>XML:<br>
Country: <input type="text" name="country" value="SE"><br>
Language: <input type="text" name="language" value="SV"><br>
<textarea name="xml-structure" cols="50" rows="10">
<VEHICLE>
<VERSION>1.00</VERSION>
<VEHICLE_INFORMATION>
<VEHICLE_INFO>
<ORDERING_MPC>1271</ORDERING_MPC>
<SPARTE>00</SPARTE>
<MODEL>117</MODEL>
<BAUMUSTER>11735212-001</BAUMUSTER>
<CONFIGURATION_DATE>2014-09-16</CONFIGURATION_DATE>
<PRICING_DATE>2014-09-16</PRICING_DATE>
</VEHICLE_INFO>
</VEHICLE_INFORMATION>
</VEHICLE>
</textarea>
</p>
<input type="submit" value=" Submit ">
</form>


</body>
</html>


Thanks again!
Tony
Tony Slosar
Motive Retail

2 Replies