Forum Discussion
Hi.
Sorry, my laptop was in the shop. Just it back today. 🙂
You are so right. This has nothing to do with security exception. I reworked that code to use XmlSlurper. But now, writing another Groovy script, I am getting the same error. The issue is with the getXmlHolder statement. The problem is with the Map being returned empty (null). I have never encountered this before. The request exists and is not large, only 140 lines. No special characters beyond $ and @. What should I be looking for? Any ideas how I can resolve this?
def holder = groovyUtils.getXmlHolder( request )
The request does exist:
- INFO: request= 576040 PSRSTAR No Angie D xxxxx 01-2176 PRRB 16-0047 12/31/2017 xxxx No 51 DSH - Code 2 & 3 Eligible Days 11/24/2021 N NPR 06/01/2021 N/A 1, 2, 4, 6, 7, 9, 20, 21, 22 176 $16,341 No No xxxxxx No 44 DSH - Dual Eligible Days - Exhausted 11/24/2021 N NPR 06/01/2021 N/A 1, 2, 4, 6, 7, 9, 20, 21, 22 176 $25,192 No No xxxxxx No 124 DSH - Dual Eligible Part C Days 11/24/2021 N NPR 06/01/2021 N/A 1, 2, 4, 6, 7, 9, 20, 21, 22 176 $12,936 No No xxxxxx No 143 DSH - SSI Systemic Errors 11/24/2021 N NPR 06/01/2021 N/A 1, 2, 4, 6, 7, 9, 20, 21, 22 176 $98,043 No No 100000035 Team2 11/24/2021 11/24/2021 11/29/2021 11/29/2021 1 Scheduled 01/15/2022 No 07/22/2022 09/20/2022 11/19/2022 Dignity Health Kenton Fong 10901 GOLD CENTER DRIVE, SUITE 300RANCHO CORDOVACACALIFORNIA956709166313612brent.smith@seniorhealth.org
Displayed error:
java.lang.NullPointerException: Cannot invoke "java.util.Set.iterator()" because the return value of "java.util.Map.entrySet()" is null See Error Log for details.
From the Error.log:
Wed Feb 02 23:51:11 EST 2022: ERROR: An error occurred in the script of the Groovy Script test step [Groovy Script - Value Set]:
Wed Feb 02 23:51:11 EST 2022: ERROR: java.lang.NullPointerException: Cannot invoke "java.util.Set.iterator()" because the return value of "java.util.Map.entrySet()" is null
java.lang.NullPointerException: Cannot invoke "java.util.Set.iterator()" because the return value of "java.util.Map.entrySet()" is null
at org.codehaus.groovy.runtime.InvokerHelper.formatMap(InvokerHelper.java:715)
at org.codehaus.groovy.runtime.InvokerHelper.format(InvokerHelper.java:655)
at org.codehaus.groovy.runtime.InvokerHelper.toString(InvokerHelper.java:152)
at org.codehaus.groovy.runtime.DefaultGroovyMethods.toString(DefaultGroovyMethods.java:15381)
at org.codehaus.groovy.runtime.StringGroovyMethods.plus(StringGroovyMethods.java:2121)
at org.codehaus.groovy.runtime.dgm$1211.invoke(Unknown Source)
at org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite$PojoMetaMethodSiteNoUnwrapNoCoerce.invoke(PojoMetaMethodSite.java:247)
at org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite.call(PojoMetaMethodSite.java:56)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:139)
at com.eviware.soapui.support.xml.Script102.overrideNode(Script102.groovy:179)
at com.eviware.soapui.support.xml.Script102$overrideNode$0.callCurrent(Unknown Source)
at com.eviware.soapui.support.xml.Script102.run(Script102.groovy:424)
Take care,
Angie
Hi Angie,
There's a few bits here....
I'm assuming you've fixed your original assertion. The one thing I was going to suggest was the value to pass into the XML Sluper.
You wrote....
def groovyUtils = new com.eviware.soapui.support.GroovyUtils( context )
def holder = context.expand( '${SOAPRequest#Response}' )
def requestHolder = groovyUtils.getXmlHolder( holder )
Whereas, I'd usually use....
def groovyUtils = new com.eviware.soapui.support.GroovyUtils( context )
def holder = context.expand( '${SOAPRequest#ResponseAsXml}' ) // This line has the change.
def requestHolder = groovyUtils.getXmlHolder( holder )
I thought this was the issue, then I re-read your latest response. The request does not look like XML. If it isn't XML then the slurper cannot work with it.
If this was me, the first thing I'd do is log the request and the raw request. E.g.
def request = context.expand( '${SOAPRequest#Request}' ) ;
log.info(request);
def rawRequest = context.expand( '${SOAPRequest#RawRequest}' ) ;
log.info(rawRequest);
I appreciate that this is not the solution, but it may get us a step or two towards that.