Forum Discussion

pravin_k99's avatar
pravin_k99
Contributor
13 years ago

How to Transfer values to multiple requests?

Hello,

I have a regression test where I need to transfer a value from a response to multiple requests. how can i do that?

I know how to transfer the a value to multiple nodes in the same request but dont know how to do it for multiple requests in one go.


Groovy is fine with me as well.

Thanks
Pravin
  • tjdurden's avatar
    tjdurden
    Frequent Contributor
    Hi Pravin,

    In the free version of SoapUI, you can use a Property Transfer step and simply add extra transfers that use the same source, but have a different target. Would this suffice?

    Cheers,
    Tim
  • Hello Tim,

    Thanks for the response but I know these things already.

    - Transfer a value from a response to a request (Property transfer)
    - Transfer a value from a response to multiple nodes of a request (Property transfer)

    What I want to know if there is way we can
    - Transfer a value from a response to multiple requests in one go?

    I know this is not possible with property transfer because property transfer requires a single target request so to send the data to multiple requests we need some kind of groovy. Isnot it?

    Thanks
    Pravin
  • tjdurden's avatar
    tjdurden
    Frequent Contributor
    Hi Pravin,

    Using a Property Transfer you can simply alter the Target to point at a different request message. Then, just add three Transfers in the single Property Transfer step, but for each transfer, change the target. E.g.

    1) Node X on Response 1 transferring from Response A to Request Message B
    1) Node X on Response 1 transferring from Response A to Request Message C
    1) Node X on Response 1 transferring from Response A to Request Message D

    Would this suffice?

    Kind regards,
    Tim
  • Tim,

    Can you add a screenshot of this thing you mentioned. How can i provide multiple requests in target?

    Pravin
  • tjdurden's avatar
    tjdurden
    Frequent Contributor
    Hi Pravin,

    It's very simple, add a new Transfer to the Property Transfer step, keep the same initial Source message (and associated node/element value), but for the second transfer step, select a different target message in the Target section, and then just change the target node/element mapping as required.

    Screenshot 1:
    Here we've setup a property transfer step and I've highlighted the first transfer within the step. In this step we would transfer a node/element value from the 'Test Request' message Response to the 'Some Other Request' message Request. (Note: I haven't added any mappings here)


    Screenshot 2:
    Again, we're using the same property transfer step, but we've added a second transfer. Here, we're transferring a node/element value from the original 'Test Request' message Response, but we've selected a different message Request as the Target, 'Another Test Request'. (Note: Again, no mapping have been added)


    Kind regards,
    Tim
  • Sorry Again Tim,

    I think you misunderstood my question. Please read my original question again

    - I know already how to transfer values from one request to another response - using a single property transfer
    - I don't want to add another property transfer to transfer another value to other request

    What I am asking it
    - I want a single step to transfer a certain value to number of requests in one go. cause I actually need literally 100s of values transferred, and I dont want to write individual property transfer for each of them.

    Pravin
  • tjdurden's avatar
    tjdurden
    Frequent Contributor
    Hi Pravin,

    I may be wrong, but I don't think you can do this in a single Property Transfer step. However, if you want to transfer a node that has a number of child nodes, you can do this in one single transfer step, but I assume the XML structure will be maintained from the Source to the Target.

    For example, if you have some XML:


    <soapenv:Envelope>
    <soapenv:Header/>
    <soapenv:Body>
    <Start>
    <myParam1>Hello</myParam>
    <myParam2>World</myParam>
    <myParam3>You're</myParam>
    <myParam4>Awesome</myParam>
    </Start>
    </soapenv:Body>
    </soapenv:Envelope>


    you can transfer the contents of the <Start> node to the Target in one go, by selecting the 'Transfer Child Nodes' option from within the Property Transfer step.

    Kind regards,
    Tim