Functional Web Services Testing Made Easy with SoapUI - Part 2
5. Add the LatLonListZipCode - Request 1 to the test case with the zip code ${Properties#zipCode}. This retrieves the zip code from the properties step we defined above. The request XML is:
<soapenv:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ndf="http://www.weather.gov/forecasts/xml/DWMLgen/wsdl/ndfdXML.wsdl">
<soapenv:Header/>
<soapenv:Body>
<ndf:LatLonListZipCode soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<zipCodeList xsi:type="dwml:zipCodeListType" xmlns:dwml="http://www.weather.gov/forecasts/xml/DWMLgen/schema/DWML.xsd">${Properties#zipCode}</zipCodeList>
</ndf:LatLonListZipCode>
</soapenv:Body>
</soapenv:Envelope>
(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)





Comments
John Baker replied on Wed, 2008/11/19 - 3:20am
Meera Subbarao replied on Wed, 2008/11/19 - 8:05am
Ehsan Sadeghi replied on Fri, 2009/01/16 - 6:26am
hi,
one question, is it possible to pass the responce from one test case to another test case. What i'm trying to do is to get a session id and then use that session id to run a load test.
Thx.
Meera Subbarao replied on Fri, 2009/01/16 - 10:58am
in response to:
Ehsan Sadeghi
shanthi bala replied on Fri, 2009/02/27 - 2:25am
Meera Subbarao replied on Tue, 2009/03/03 - 11:18am
in response to:
shanthi bala
Suresh Reddy replied on Wed, 2009/03/18 - 10:24pm
After seeing into ur article I whould like to know how can i obtain session ID to logout automatically when I login and logout of the webapplicaiton.
Nelson Nazareth replied on Tue, 2009/06/16 - 6:47pm
syed ali replied on Thu, 2009/08/06 - 4:25am
Hi Meera,
How could I change the project properties, test suite properties or testcase properties values using Groovy script test step. I wasn't able to understand the syntax.
def sessionID = context.expand( '${#Project#SessionID}' )
def testSuiteProperty = context.expand( '${#TestSuite#TestSuiteProperty}' )
def test1 = context.expand('${#TestCase#test}' )
I understood the above lines collect the values of the given properties. Please help me to set the value for SessionID, TestSuiteProperty, test parameters. Thanks in advance.
syed ali replied on Fri, 2009/08/07 - 2:29am
in response to:
syed ali
I have found the info. The format is as follows:
testRunner.testCase.testSuite.project.setPropertyValue("SessionID","2002")
testRunner.testCase.testSuite.setPropertyValue("TestSuiteProperty","testSuiteProperty")
testRunner.testCase.setPropertyValue("test","testcase property")
However, I have another issue. If the assertion is faliled I am unable to continue to execute the further steps of testcase. Please help me regarding this concern...
kiran kmk replied on Mon, 2009/09/14 - 4:16am
I am trying to get the Node Value but I get it as Null
IST 2009:INFO:null
This is the Script I am running groovyUtils = new com.eviware.soapui.support.GroovyUtils( context ) holder = groovyUtils.getXmlHolder("GetData - Request 1#Response") dwmlByDayOut = holder.getNodeValue( "//GetDataResponse" )
Below are the Request Iam sending and the response I get
${Properties#Addvalue}
This is my response
You entered: 500
Geza Szent-andrassy replied on Fri, 2009/10/09 - 3:13am
Hi all!
For the TestCase setup script to work, i think it needs to add the following lines before file.createNewFile(), Otherwise i experienced an IOException, which was thrown by file.createNewFile(), when the parent directory had not existed before.
...
if(!file.exists())
{
if (file.getParentFile() != null) {
file.getParentFile().mkdirs()
}
file.createNewFile()
...
Nice article, anyway!
john green green replied on Mon, 2009/10/26 - 3:26am
Naveen Kumar replied on Wed, 2009/11/25 - 7:31am
Rambabu Nadakudati replied on Fri, 2010/03/05 - 12:37pm
Rambabu Nadakudati replied on Tue, 2010/03/09 - 3:32pm
Nikhil Gupta replied on Fri, 2010/07/23 - 6:09am
Test Dude replied on Wed, 2010/10/20 - 3:17pm
Durga Nuvvula replied on Tue, 2010/12/07 - 5:49pm
My objective is to get the response values out of the Response that is obtained from the SOAP UI in the assertion script.
I have tried to parse the response the way you suggested in the article and its returning null.
def groovyUtils = new com.eviware.soapui.support.GroovyUtils( context )
def responseHolder = groovyUtils.getXmlHolder("get-xyz-response Request 1#Response" )
when trying to get the
XPath
def appearanceColorResponse = responseHolder.getNodeValue("//appeareance-color")
I am getting the appearanceColorResponse as null.
Also I tried the other way registering the namespaces before doing the xpath.
def groovyUtils = new com.eviware.soapui.support.GroovyUtils( context )
def responseHolder = groovyUtils.getXmlHolder( messageExchange.responseContent )
declare namespace ns4='http://www.xyz.com/schemas/xyz/abc';
declare namespace ns1='http://www.xyz.com/schemas/xyz/def';
declare namespace ns2='http://www.xyz.com/schemas/xyz/klm';
declare namespace ns3='http://www.xyz.com/schemas/xyz/pqr';
def appearanceColorResponse = responseHolder.getNodeValue("//ns2:message[1]/ns2:message-body[1]/ns1:person-detail[1]/ns3:person[1]/ns4:entity[1]/ns4:appeareance-color[1]);
I am getting the appearanceColorResponse as null.
Ram Kumar replied on Tue, 2011/04/19 - 9:35am
Hi meera,
How do i do data driven testing using excel sheets in soap ui along with groovy.. i mean reading data through an excel sheet. and i would like to capture the result from soap response and to write in to the specific cell in the out put excel document.
Please give me the details..I need to write some regression suites ..
Thanks
-Ram
Mahadeva Prasad replied on Wed, 2011/06/15 - 6:01am
I am new to SOAP UI.I wrote my application in using cakephp framework.I want to conduct web testing using a SOAP UI,like how to click a links and how to click a submit button once all input fields are entered.And also i want information about WSDL files.
Sandeep Manganellore replied on Fri, 2011/10/14 - 10:31am
in response to:
Meera Subbarao
Vivek Kumar replied on Fri, 2011/12/30 - 10:39am
Carla Brian replied on Sun, 2012/07/15 - 5:36pm
Peter Keller replied on Fri, 2012/09/14 - 3:00pm
Loading the WSDL you used I got following error message:
"Error loading [http://www.weather.gov/forecasts/xml/DWMLgen/wsdl/ndfdXML.wsdl]: org.apache.xmlbeans.XmlException: org.apache.xmlbeans.XmlException: error: does not close tag"
So I used following URL instead: http://graphical.weather.gov/xml/SOAP_server/ndfdXMLserver.php?wsdl
However, invoking the ZIP service using this URL, I get following response where the latLonList is not a proper XML tag but a escaped text field:
<SOAP-ENV:Envelope SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"><SOAP-ENV:Body>
<ns1:LatLonListZipCodeResponse xmlns:ns1="http://graphical.weather.gov/xml/DWMLgen/wsdl/ndfdXML.wsdl">
<listLatLonOut xsi:type="xsd:string"><?xml version='1.0'?><dwml version='1.0' xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xsi:noNamespaceSchemaLocation='http://graphical.weather.gov/xml/DWMLgen/schema/DWML.xsd'><latLonList>38.8787,-77.1019</latLonList></dwml></listLatLonOut>
</ns1:LatLonListZipCodeResponse>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
Am I doing something wrong? Does your setup still work? I am using SoapUI 4.5.1. Thanks.
Andri Purmawinata replied on Thu, 2013/04/04 - 12:55am
Hi,
Thanks very much for your blog. Sorry for newbie question. I'm new to api/web services groovy testing.
What does it mean with ("LatLonListZipCode - Request 1#Response")?
holder = groovyUtils.getXmlHolder("LatLonListZipCode - Request 1#Response")