tpowers
15 years agoOccasional Contributor
[SOLVED] Help with the 'groovyUtils.getXmlHolder'
I am using soapUI mock service to test a client calling from a DB (Intersystems Cache), and I can't seem to read properties into my dispatch script (I also am using them in the response) from the xml holder.
I am thinking it has something to do with the format of the incoming request, but i cannot seem to make the XML holder read in the values from my live client WS.
This request, generated from soapUI works fine...
I am able to assign properties with the following code.....
However when I get the following request from my client (or the same format when sent from soapUI)...
I cannot assign any values if the script is written as follows.....
I also notice that this request is read in 'flat' meaning that when I view the request detail from the mock service editor it looks like this....(note the !CDATA[string]] at the end)
...While the first sample from above appears as formatted XML when viewed in the same pane.
Any ideas how I can read in properties if my requests are arriving like this???
Any help is greatly appreciated!!
-Tim
I am thinking it has something to do with the format of the incoming request, but i cannot seem to make the XML holder read in the values from my live client WS.
This request, generated from soapUI works fine...
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:tem="http://tempuri.org/">
<soapenv:Header/>
<soapenv:Body>
<tem:RunScript>
<!--Optional:-->
<tem:optionObject>
<tem:EntityID>5</tem:EntityID>
<tem:Facility>98</tem:Facility>
<Forms>
<FormObject....
I am able to assign properties with the following code.....
def groovyUtils = new com.eviware.soapui.support.GroovyUtils( context )
def holder = groovyUtils.getXmlHolder( mockRequest.requestContent )
context.Facility = holder.getNodeValue( "//tem:Facility")
context.EntityID = holder.getNodeValue( "//tem:EntityID")
However when I get the following request from my client (or the same format when sent from soapUI)...
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:s="http://www.w3.org/2001/XMLSchema">
<SOAP-ENV:Body>
<RunScript xmlns="http://tempuri.org/">
<optionObject>
<EntityID>5</EntityID>
<Facility>98</Facility>
<Forms>
<FormObject....
I cannot assign any values if the script is written as follows.....
def groovyUtils = new com.eviware.soapui.support.GroovyUtils( context )
def holder = groovyUtils.getXmlHolder( mockRequest.requestContent )
context.Facility = holder.getNodeValue( "//Facility")
context.EntityID = holder.getNodeValue( "//EntityID")
I also notice that this request is read in 'flat' meaning that when I view the request detail from the mock service editor it looks like this....(note the !CDATA[string]] at the end)
<?xml version="1.0" encoding="UTF-8" ?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV='http://schemas.xmlsoap.org/soap/envelope/' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xmlns:s='http://www.w3.org/2001/XMLSchema'>
<SOAP-ENV:Body>
<RunScript xmlns="http://tempuri.org/"><optionObject><EntityID>5</EntityID><Facility>98</Facility><Forms><FormObject><CurrentRow><Fields><FieldObject><FieldNumber>2</FieldNumber><FieldValue><![CDATA[ROSS,JOE]]>....
</SOAP-ENV:Envelope>
...While the first sample from above appears as formatted XML when viewed in the same pane.
Any ideas how I can read in properties if my requests are arriving like this???
Any help is greatly appreciated!!
-Tim