Forum Discussion

Javier's avatar
Javier
Occasional Contributor
17 years ago

groovy utils - modify response

hello!!

i have a method 'void' with this fault response:





?



?





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!!

8 Replies

  • omatzura's avatar
    omatzura
    Super Contributor
    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
  • Javier's avatar
    Javier
    Occasional Contributor
    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!!!
  • omatzura's avatar
    omatzura
    Super Contributor
    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
  • Javier's avatar
    Javier
    Occasional Contributor
    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!!
  • omatzura's avatar
    omatzura
    Super Contributor
    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
  • Javier's avatar
    Javier
    Occasional Contributor
    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...
  • omatzura's avatar
    omatzura
    Super Contributor
    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