Contributions
Trouble Extracting Element from response
I'm having trouble extracting element from the response. The following is the response: <Response xmlns="https://llapiu4.servevirtual.net/AccountWCFRestService/AccountServiceHost.svc/AccountService"> <Header> <RequestDatetime>03/08/2013 02:41:05 AM</RequestDatetime> <RequestId>soupUI_5712703161</RequestId> <ServeTransactionDateTime>03/07/2013 01:41:04 PM</ServeTransactionDateTime> <ServeTransactionId>282812</ServeTransactionId> </Header> <Payload/> <RequestType>OPEN_ACCOUNT</RequestType> <StatusCode>90001</StatusCode> <StatusDescription>System Internal Error</StatusDescription> </Response> I entered the following code as the script assertion point: import com.eviware.soapui.support.XmlHolder def holder = new XmlHolder( messageExchange.responseContentAsXml ) def node = holder.getNodeValue("//RequestId") def stream = messageExchange.responseContentAsXml.toString() log.info node log.info stream Node value returned is 'null' but I'm expecting: soupUI_5712703161. What am I doing wrong? Thanks for the help.12 years agoPlace ReadyAPI QuestionsReadyAPI Questions2.9KViews0likes4CommentsRe: java.lang.NullPointerException error when using XmlHolder in Groovy script
Thank you guys. here is the synthax that I had to use: def holder = groovyUtils.getXmlHolder(context.expand('${ListColors - Request 1#Response}')) Before all I had to use is : def groovyUtils = new com.eviware.soapui.support.GroovyUtils( context ) def holder = groovyUtils.getXmlHolder( "ListColors#Response" ) and it worked. Did the synthax changed in the new version ?4KViews0likes1CommentRe: java.lang.NullPointerException error when using XmlHolder in Groovy script
Project is attached to this post. TestSuite 1 TestCase 1. You will not be able to get the response though because the service runs localy on my macine. Full response XML file is this: 22 amber 1 beige 2 black 3 blue 4 blue-green 5 brown 6 clear 7 gray 8 green 25 green-yellow 9 maroon 27 opalescent 20 opaque 10 orange 28 orange-brown 11 peach 12 pink 23 pink-orange 13 purple 14 red 21 red-brown 19 red-orange 24 red-pink 15 rust 26 tan 16 white 17 yellow 18 yellow-orange Thanks guys.4KViews0likes0Commentsjava.lang.NullPointerException error when using XmlHolder in Groovy script
I'm getting the following error when using groovy script step: java.lang.NullPointerException at com.eviware.soapui.support.XmlHolder. (XmlHolder.java:52) at com.eviware.soapui.support.GroovyUtils.getXmlHolder(GroovyUtils.java:54) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite$PojoCachedMethodSiteNoUnwrapNoCoerce.invoke(PojoMetaMethodSite.java:229) at org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite.call(PojoMetaMethodSite.java:52) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:125) at Script1.run(Script1.groovy:4) at com.eviware.soapui.support.scripting.groovy.SoapUIGroovyScriptEngine.run(SoapUIGroovyScriptEngine.java:93) at com.eviware.soapui.impl.wsdl.teststeps.WsdlGroovyScriptTestStep.run(WsdlGroovyScriptTestStep.java:148) at com.eviware.soapui.impl.wsdl.panels.teststeps.GroovyScriptStepDesktopPanel$RunAction$1.run(GroovyScriptStepDesktopPanel.java:274) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at java.lang.Thread.run(Unknown Source) All I'm doing is using the following lines of code: def groovyUtils = new com.eviware.soapui.support.GroovyUtils( context ) log.info( groovyUtils.projectPath ) def holder = groovyUtils.getXmlHolder( "ListColors#Response" ) My response looks like the following: 22 amber 1 beige Am I doing something wrong or is this a SOAPUI bug ? Thanks7KViews0likes10Comments