|
Title: groovy utils - modify response Post by: Javier on July 03, 2007, 09:25:57 am hello!!
i have a method 'void' with this fault response: <soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope"> <soap:Body> <soap:Fault> <soap:Code> <soap:Value>?</soap:Value> </soap:Code> <soap:Reason> <!--1 or more repetitions:--> <soap:Text xml:lang="?">?</soap:Text> </soap:Reason> </soap:Fault> </soap:Body> </soap:Envelope> the next step is modify the values with the groovy utils ( script ) because i want to use "mappers" from values to property file ( propertyTransfer ). the script is: def groovyUtils = new com.eviware.soapui.support.GroovyUtils( context ); log.info( groovyUtils.projectPath ); // create holder for last response def holder = groovyUtils.getXmlHolder( "write - Request#Response" ) holder.setNodeValue( "soap:Envelope/soap:Body/soap:Fault/soap:Code/soap:Value", "1" ); // update request with updated xml groovyUtils.setPropertyValue( "write - Request", "Response", holder.prettyXml ); this is ok...but the values of the property has this values: "?" ??? how I could resolve it? thanx alot!! Title: Re: groovy utils - modify response Post by: omatzura on July 03, 2007, 09:34:16 am Hi,
thanks for reposting :-) The Response property is read-only, so you won't be able to set the updated response.. but you can check that the update went ok with log.info( holder.prettyXml ) What exactly do you want to do? Maybe there is some other way I can help you with!? regards, /Ole eviware.com Title: Re: groovy utils - modify response Post by: Javier on July 03, 2007, 11:15:26 am My "problem" is the void method: write ... i can't edit the response .. adding groovy script
one idea .... use 'PropertyTransfer' .. transfer the data from response to porperty ... edit the values "?" by another ones using groovy utils...but it doesn't work. do you have another idea?? again...thanx alot!!! Title: Re: groovy utils - modify response Post by: omatzura on July 03, 2007, 12:59:32 pm Hi again,
I'm not really sure of your use-case here.. as far as I understand you 1) have a request to a webservice that 2) returns an empty soap 1.2 fault message.. 3) You then want to modify the fault message 4) before using a property-transfer to transfer values from it to a 5) properties-step, which you then save to a file.. is this correctly understood? regards! /Ole eviware.com Title: Re: groovy utils - modify response Post by: Javier on July 03, 2007, 01:32:18 pm yes...perfect!
i try to do a testsuite with several testcase like a sequence...i am passing the values from one test to other test...it is like a simulation... thanx!! Title: Re: groovy utils - modify response Post by: omatzura on July 03, 2007, 02:16:03 pm Hi,
Try writing the modified response to a temporary property in your properties-step and then use this property as the source of your property-transfer!? regards, /Ole eviware.com Title: Re: groovy utils - modify response Post by: Javier on July 06, 2007, 09:13:38 am good!
another question about this Testcase. Now, if i do a submit the request and works OK, there is not a Response. Then, the testcase fail: "--> Invalid/empty response"....i don't have any assertion... and i am not sure if it is a problem with the wsdl or the tool... ??? Title: Re: groovy utils - modify response Post by: omatzura on July 06, 2007, 09:32:56 am Hi,
you can uncheck the "abort on error" option in the TestCase options dialog, then the TestCase will continue even after a failed teststep regards, /Ole eviware.com Title: Re: groovy utils - modify response Post by: Javier on July 06, 2007, 09:48:21 am ahh good!!
:D |