cancel
Showing results for 
Search instead for 
Did you mean: 

Groovy XML Parsing Help

Super Contributor

Groovy XML Parsing Help

Hello,
I have a element that looks something like this



3085CBFTCBFT - Société Radio-CanadaCBFT02Analog

15756CBFT-HDCBFT-HD ( SOCIÉTÉ RADIO-CANADA )CBFT-HD30852.12.1Digital




I am trying to write some kind of loop that does the following.
1. count number of 'Channel'
2. for each Channel, store all of its attributes (e.g. source_id, short_name, etc) into some variable.

Can you help me out with this.

Thanks

Ali 
7 REPLIES 7
Super Contributor

Re: Groovy XML Parsing Help

Hi Ali,

sure.. to give you the best suggestion could you let me know how you intend to use these created objects?

regards!

/Ole
eviware.com
Super Contributor

Re: Groovy XML Parsing Help

I need to validate the response below(XML/RPC) by calling another soap based service. I also have to validate the response against a stored procedure call in the database.

This is what I plan on doing ( I am open to other suggestions)

1. for each channel in the response below, store all the channel attributes
2. Call the Validation Web Service. Search the service response based on the sourceId
3. Call the validation stored proc. search the result set for corresponding row based on sourceId.
Super Contributor

Re: Groovy XML Parsing Help

Hi,

could you maybe use the response as an XML DataSource and then inside the corresponding DataSource Loop make a request for the first validation and another DataSource for the second? ie something like

- Request
- DataSource [XML: Request/Response property with corresponding xpaths]
- Second Request
- DataSource for validation
- DataSourceLoop back to DataSource

?

regards!

/Ole
eviware.com
Super Contributor

Re: Groovy XML Parsing Help

that would be pretty cool. How do I do this ?

Ali
Super Contributor

Re: Groovy XML Parsing Help

I am guessing this is using XML Datasource. I am trying to use this but am unable to get it to work.
I have the following config

sourceStep: test request where one of the element has XML inside of it (lineup XML in original example)
source property: response
row Xpath: selected from response (//methodResponse[1]/params[1]/param[1]/value[1]/struct[1]/member[2]/value[1]/string[1])
Column Xpath: source_ID/text()
Property: source_ID

When I click on the 'play' button, I dont get any rows of 'source_ID'

Not sure what I am doing wrong.

Ali
Super Contributor

Re: Groovy XML Parsing Help

Hi Ole,
I actually found an old post of mine that actually addressed this and answers my question.

http://www.eviware.com/component/option ... opic,241.0
Super Contributor

Re: Groovy XML Parsing Help

Great! Let me know if you need any more assistance!

regards,

/Ole
eviware.com
New Here?
Join us and watch the welcome video:
API Testing Mistake #2
APITestingMistake#2