Forum Discussion
You are correct. I did a mistake in the configuration. Using one of your earlier comment in a post (https://community.smartbear.com/t5/SoapUI-Pro/DataSource-XML-not-returning-data/td-p/147087/page/3), I corrected it and now the data is getting displayed.
Now, I want to pass this data into an array. Can you please help to do that as well.
Glad you got the data getting returned. It took me awhile to puzzle that piece out my first time. :) When you say store these pieces of data in an array, what do you mean and what is the intent? I may need some examples of what you are trying to do and some sample requests / responses / etc to figure this next part out. :)
- MKV6 years agoContributor
I have a set of attributes in response which is stored in DB in JSON format. Validating if the details in DB are retrieved in response correctly is my final motive.
So, I have split the JSON data and stored it in different arrays - say attributeName, attributeId, attributeValue.
Similarly, I wanted to store the xml response attribute details in an array and finally compare both the arrays.
I have successfully did the Json data storing in array. Now, I wanted to have the response data also to be stored in array, so that i can conclude by comparing both the arrays. Please suggest.
Sample response:
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<ns4:GetAccountDetailsResponseMessage></ns4:account>
.....
<ns6:CustomCustomerAccount>
<ns3:attributes>
<ns3:attributeName>TELE</ns3:attributeName>
<ns3:attributeId>TRUE</ns3:attributeId>
<ns3:attributeValue/>
</ns3:attributes><ns3:attributes>
<ns3:attributeName>SMS</ns3:attributeName>
<ns3:attributeId>AVAILABLE</ns3:attributeId>
<ns3:attributeValue/>
</ns3:attributes></ns6:CustomCustomerAccount>
</ns4:account>
</ns4:GetAccountDetailsResponseMessage>
</soap:Body>
</soap:Envelope> - MKV6 years agoContributor
I was trying to iterate specific xml node. I could get only the first node value only. Not able to iterate. Please help.
This is my script:
def WS_attributeNameList=[]
def WS_attributeNameList_Converted=[]import com.eviware.soapui.support.XmlHolder
def response = context.expand( '${WS_GetAccountDetails#Response#declare namespace ....//ns4:GetAccountDetailsResponseMessage[1]}' )
def xml = new XmlHolder(response)
WS_attributeNameList = context.expand( '${WS_GetAccountDetails#Response#declare namespace ....//ns4:GetAccountDetailsResponseMessage/ns4:accounter/ns6:CustomerCustomAccounter/ns3:attributes/ns3:attributeName}' )
WS_attributeNameList_Converted=WS_attributeNameList.toString()
log.info (WS_attributeNameList_Converted)I'm not sure how to use groovy for iterating specific node - say attributename and store them in array. If I can do this, I can then sort it and make the required validation. Please help.
- MKV6 years agoContributor
I just realised to use Data sink option. I'm able to get the data source output values. But they are not getting appended to the array. Can someone help to append the data sink values to an array. [so it does not overwrite the existing values]
I have created a data sink with Groovy where my groovy script goes like this.
def WS_AttributeNameList = []
SinkValue=context.expand('${DataSink_AttributeName#WS_AttributeName}')
WS_AttributeNameList.add(SinkValue)
log.info (WS_AttributeNameList)
Every time, it overwrites the value in the current iteration. It doesn't seem to append the data. Can someone please help to resolve this.
Thanks!
Related Content
- 5 years agounderqualified
- 3 years agogoogleid_114550