Forum Discussion

alex98uk's avatar
10 years ago

Referencing a list

Hello *,

I am new to SoapUI and having to teach myself on the job (no one else knows it here). Currently I have a basic program for deleting an object in my system:

Properties
Login (soap)
Groovy script (grabs session headers)
Property transfer
Delete Folder (soap)
Logout (soap)


The "Delete Folder" stage can delete one defined object at a time:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:ws.domain.com">
<soapenv:Header>
<urn:SessionHeader>
<urn:sessionId>${Properties#session}</urn:sessionId>
</urn:SessionHeader>
</soapenv:Header>
<soapenv:Body>
<urn:deleteFolder>
<urn:folderName>ee_p15601_tues_wk02</urn:folderName>
</urn:deleteFolder>
</soapenv:Body>
</soapenv:Envelope>


I have comma delimited list of folder names to go inside the "folderName" parameter, but i'm not sure how to automate this and there are too many to keep manually replacing this parameter (the call can only delete one at a time)!

Is it possible to somehow have this parameter automatically changed and run through the list until empty? I did search around, but I couldn't find anything specific to what I wanted to do...



Thank you all!

1 Reply

  • PaulDonny's avatar
    PaulDonny
    Regular Contributor
    This is actually very easy to obtain within SoapUI, depending on the level of validation that is required. If it is 1 simple web call that you just need ran just do the following:

    (Note: I am using the currency converter WSDL as an example with no validation at all)

    def currencies = ['AFA','ALL','DZD','ARS','AWG','AUD','BSD','BHD','BDT','BBD','BZD','BMD','BTN','BOB','BWP','BRL','GBP','BND','BIF','XOF','XAF','KHR','CAD','CVE','KYD','CLP','CNY','COP','KMF','CRC','HRK','CUP','CYP','CZK','DKK','DJF','DOP','XCD','EGP','SVC','EEK','ETB','EUR','FKP','GMD','GHC','GIP','XAU','GTQ','GNF','GYD','HTG','HNL','HKD','HUF','ISK','INR','IDR','IQD','ILS','JMD','JPY','JOD','KZT','KES','KRW','KWD','LAK','LVL','LBP','LSL','LRD','LYD','LTL','MOP','MKD','MGF','MWK','MYR','MVR','MTL','MRO','MUR','MXN','MDL','MNT','MAD','MZM','MMK','NAD','NPR','ANG','NZD','NIO','NGN','KPW','NOK','OMR','XPF','PKR','XPD','PAB','PGK','PYG','PEN','PHP','XPT','PLN','QAR','ROL','RUB','WST','STD','SAR','SCR','SLL','XAG','SGD','SKK','SIT','SBD','SOS','ZAR','LKR','SHP','SDD','SRG','SZL','SEK','CHF','SYP','TWD','TZS','THB','TOP','TTD','TND','TRL','USD','AED','UGX','UAH','UYU','VUV','VEB','VND','YER','YUM','ZMK','ZWD','TRY']
    for (String currency in currencies) {
    context.currency = currency;
    testRunner.runTestStepByName("ConversionRate");
    }


    And the code in the request:
    (Note the context variable matches the one from the groovy script)
    <soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:web="http://www.webserviceX.NET/">
    <soap:Header/>
    <soap:Body>
    <web:ConversionRate>
    <web:FromCurrency>USD</web:FromCurrency>
    <web:ToCurrency>${=context.currency}</web:ToCurrency>
    </web:ConversionRate>
    </soap:Body>
    </soap:Envelope>