Forum Discussion

cbyndr's avatar
cbyndr
Contributor
16 years ago

[SOLVED]best way to get at/transfer contents of an AMF Request Step's response?

I have a test case sending a request to a secured AMF endpoint. The request returns an ASObject:


 
   
   
     
        0.75
        12
     

      16
      9
      contactRowId
      1-2P2K00
      billing
      true
      vendorContactOnly
      false
      vendorAdmin
      false
      admin
      true
   

   
     
        false
        false
        net.co.sb.dto.ContactDTO
     

   

 



I'd like to use some of these strings for later test steps. Is there a way to parse this AMF response/ASObject from a Groovy Script step, similar to how we'd parse an XML response?

I did try creating a Property Transfer from the AMF response, but the Property Transfer step is created without the Property, Transferred Value's source property is always missing.

3 Replies

  • Hi!

    Sorry for the delayed response, we are working on exposing the XML as a response property (just like for the other teststeps), the fix will hopefully be in the upcoming nightly build... sorry to keep you waiting.

    regards!

    /Ole
    eviware.com
  • Yes! With nightly build from 2/5/2010 I can transfer AMF response content to properties steps, and other amf requests.
  • It's easy enough to get at the AMF response from a Groovy script using the getXmlHolder method..

    Simply use the responseAsXML property instead of the response property:

    E.G.

    def groovyUtils = new com.eviware.soapui.support.GroovyUtilsPro( context )
    def response = groovyUtils.getXmlHolder( "amf-request-get-contacts#responseAsXML" )
    def quota = response.getNodeValue("//object-array[1]/flex.messaging.io.amf.ASObject[1]/map[1]/string[8]")

    What I like to do from there is save the property to a properties step:

    def props = testRunner.testCase.getTestStepByName("properties")
    def user_quota = props.setPropertyValue("quota", quota);

    And then set up the AMF request's method argument to evaluate to the property:

    ${properties#quota}

    If the AMF request needs an object for the method argument, you can grab responseAsXML contents via the AMF step's from the script editor.