Forum Discussion

Intermountain_H_3's avatar
14 years ago

Build the request using the response of another method

Hi,
We have few methods in a service like add, append, delete. But the default created request has only one Item. so while testing the append, I would like to delete few of existing items and then append few of items. For this I would like to build the request dynamically with the items. Wanting to keep this as simple as possible, I would like to have suggestions on that. Below is the sample request for the append, have highlighted the structure which has to be dynamically added for multiple items (cListItem has cardinality 0...*). Before running the append, I run get and get the list of items for UserA to add the items to UserB. Currently I am adding by one item after another in the datasource loop, datasource is xml response of the get. But would like to add all the items at one time instead of loop, so need help with that. Any help is appreciated.

<soapenv:Body>
<com:appendCListItems>
<FromUserID>${#TestCase#UserA}</FromUserID>
<ToUserID>${#TestCase#UserB}</ToUserID>
<OrderType>${#TestCase#orderType}</OrderType>
<CListItem>
<cListItemId>${DataSource 2#clid}</cListItemId>
<status>true</status>
</CListItem>

</com:appendCListItems>
</soapenv:Body>

Thanks,
Raj

6 Replies

  • Hi!

    hmm.. couldn't you transfer the entire block of items from the response to the request using a property-transfer (using XQuery to change anything on the way...)

    Alternatively - set up a property-datasink that you target with your datasource loop, and then insert that aggregated property value into the request (see http://soapui.org/Functional-Testing/sa ... cks-of-xml)

    regards!

    /Ole
    SmartBear Software
  • Ole,
    Thank You for the fast reply. I have aggregated the xml in to property using Datasink as mentioned. But can you also please let me know how to add the property in to the request replacing the text that is already present. Sorry if it is dumb question.
    I have tried groovyUtils, xmlHolder. DomNode but was it added the value as CDATA.

    Thanks,
    Raj



    SmartBear Support wrote:
    Hi!

    hmm.. couldn't you transfer the entire block of items from the response to the request using a property-transfer (using XQuery to change anything on the way...)

    Alternatively - set up a property-datasink that you target with your datasource loop, and then insert that aggregated property value into the request (see http://soapui.org/Functional-Testing/sa ... cks-of-xml)

    regards!

    /Ole
    SmartBear Software
  • Hi,

    could you use a property-transfer? Are you replacing a single node in the target xml ?

    regards,

    /Ole
    SmartBear Software
  • well, with the datasink I got the whole list of nodes are concatenated in xml format and stored in a string, trying to place the string in to the request ( is that possible ?). If not what is alternative ? can't use property transfer cause I am not sure how many nodes will be present in the response of the get method. If I am missing something in property transfer, please let me know... Thanks for the help....

    SmartBear Support wrote:
    Hi,

    could you use a property-transfer? Are you replacing a single node in the target xml ?

    regards,

    /Ole
    SmartBear Software
  • Hi,

    I'm sorry - I meant a property transfer that has the aggregated property in your DataSink as source and the request as target - does that make sense?

    thanks,

    /Ole
    SmartBear Software