How to append a Tag in a existing XML as per count increases Dynamically through Data source
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
How to append a Tag in a existing XML as per count increases Dynamically through Data source
I have a requirment where i need to dynamically increase/append the tag as the count increases
USING GROOVY
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Are you referring to a SoapUI Pro DataSource? If you are, please move your post to the SoapUI Pro forum.
Otherwise, please be specific:
What is the XML you want to update? (Post the real thing or a modified example that we can work with).
When should it be updated?
What should the result look like, based on the starting XML?
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
HI xml we need to manipulate. it is in soap ui free version only we need to increase the Participantcount tag dynamically using groovy when we give count as per from csv/excel file
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You can turn a request like this:
<request> <a>${a}</a> <b>${b}</a> <ParticipantCount>${age1}</ParticipantCount>
<ParticipantCount>${age2}</ParticipantCount>
<ParticipantCount>${age3}</ParticipantCount>
</request>
Into one like this:
<request> <a>${a}</a> <b>${b}</a> ${participants}
</request>
Then you just need to build 'participants' with some sort of a loop across all the data.
String s = "" for (Participant p : getParticipants()) { s += "<ParticipantCount>${p.age}</ParticipantCount>\n" } context['participantsAsXml'] = s
Is that what you meant?
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi wasnt able to understand it properly can u please give a detail on it please find updated Request XML
<InterfaceRQ xmlns="*****">
<RequestHeader>
<UserID>${#TestSuite#UserID}</UserID>
<SessionID>${#TestSuite#SessionID}</SessionID>
<TransactionID>${#TestSuite#TransactionID}</TransactionID>
<SupplierCredentialsList>
<SupplierCredentials>
<SupplierID>${#TestSuite#SupplierID}</SupplierID>
<Sequence>1</Sequence>
<Credentials>
<Credential name="${#TestSuite#CredOne}" isEncrypted="${#TestSuite#Encyp}">${#TestSuite#USERNAME}</Credential>
<OperationURLs>
<OperationURL operation="all">${#TestSuite#OperationURL}</OperationURL>
</OperationURLs>
</Credentials>
</SupplierCredentials>
</SupplierCredentialsList>
</RequestHeader>
<RequestBody>
<OTA_TourAvailRQ>
<ProcessingInformation PricingCurrency="${#TestSuite#PricingCurrency}"/>
<Tour>
<Location>
<Address>
<CountryName Code="${#TestSuite#CountryName}"/>
</Address>
<Region RegionCode="${#TestSuite#RegionCode}" />
</Location>
<Schedule StartPeriod="${#TestSuite#StartPeriod}" EndPeriod="${#TestSuite#EndPeriod}"/>
<Participant Quantity="${#TestSuite#Quantity}" Age="${#TestSuite#Age}">
<QualifierInfo Extension="">${#TestSuite#Extension}</QualifierInfo>
<!-- Value Can be Adult,Child,Infant -->
</Participant>
</Tour>
</OTA_TourAvailRQ>
</RequestBody>
</SightSeeingInterfaceRQ>
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Regards,
Rao.
