Forum Discussion
Hi Nmrao ,
I have a an xml below
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns="http://webservices.amazon.com/AWSECommerceService/2011-08-01">
<soapenv:Header/>
<soapenv:Body>
<ns:CartAdd>
<!--Optional:-->
<ns:MarketplaceDomain>?</ns:MarketplaceDomain>
<Domains>
<Domain ExternalCode="Bounrt" Value="3"/>
<Domain ExternalCode="EVrtrt" Value="SE"/>
<Domain ExternalCode="EVArt" Value="SpecialEvents"/>
<Domain ExternalCode="SubmissionReceivedDt" Value="2017-03-27T00:00:00-05:00"/>
</Domains>
</ns:CartAdd>
</soapenv:Body>
</soapenv:Envelope>
Want to send random value in attribute ExternalCode
Please help on this
- nmrao7 years agoChampion Level 3
Try one of the two methods as given below:
Random String of 10 letters
You may use below code snippet to generate 10 lettered string
new Random().with { (1..10).collect { (('a'..'z').join().toString()) [ nextInt(25) ] }.join() }
If you want it to apply your case, this can be done inline of the xml
<Domain ExternalCode="${= new Random().with { (1..10).collect { (('a'..'z').join().toString()) [ nextInt(25) ] }.join() }}" Value="3"/>
Or you may also use uuid
<Domain ExternalCode="${= UUID.randomUUID()}" Value="SE"/>
Related Content
Recent Discussions
- 2 days agoemoya
- 2 days agoMyBalanceNow