URGENT- SOAPUI- Dynamical XML for creating elements
SOLVED- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-26-2019
01:16 PM
03-26-2019
01:16 PM
URGENT- SOAPUI- Dynamical XML for creating elements
Hi, I have a below structure in my Test case
Note - I am using Soapui PRO
1) Data source - reading multiple rows from Excel file
2) Request method
3) Data source loop
When I run the test case, data source takes multiple rows from the Excel file. It loops each row and generates separate XML file for each row. For example
Message 1 for first row in Excel
Header XML elements
<......>
Child XML elements
Ship no 1
Qty 1
Batch number 001
Message 2 for second row in Excel
Header XML elements
Child XML elements
Ship no 2
Qty 5
Batch number 002
_-----------++++++----------
What I want is
Message
Header XML elements
Child XML elements
Ship no 1
Qty 1
Batch number 001
Ship no 2
Qty 5
Batch number 002
Note - I am using Soapui PRO
1) Data source - reading multiple rows from Excel file
2) Request method
3) Data source loop
When I run the test case, data source takes multiple rows from the Excel file. It loops each row and generates separate XML file for each row. For example
Message 1 for first row in Excel
Header XML elements
<......>
Child XML elements
Ship no 1
Qty 1
Batch number 001
Message 2 for second row in Excel
Header XML elements
Child XML elements
Ship no 2
Qty 5
Batch number 002
_-----------++++++----------
What I want is
Message
Header XML elements
Child XML elements
Ship no 1
Qty 1
Batch number 001
Ship no 2
Qty 5
Batch number 002
Solved! Go to Solution.
8 REPLIES 8
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-26-2019
10:40 PM
03-26-2019
10:40 PM
You may need to change the approach.
What purpose it is solving to have excel? Instead why can't you have desired request in the request itself?
Regards,
Rao.
What purpose it is solving to have excel? Instead why can't you have desired request in the request itself?
Regards,
Rao.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-26-2019
11:14 PM
03-26-2019
11:14 PM
Thanks for picking this up.
As my number of lines may be different in each request for example it may be 3 or 4 or 6 etc so I am using Excel to pass data to request instead of creating XML elements based on data and hardcoding them with parameters.
Thanks
As my number of lines may be different in each request for example it may be 3 or 4 or 6 etc so I am using Excel to pass data to request instead of creating XML elements based on data and hardcoding them with parameters.
Thanks
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-27-2019
06:00 AM
03-27-2019
06:00 AM
Rao - Should I provide more details on my requirements or it's clear. See above post
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-28-2019
01:33 AM
03-28-2019
01:33 AM
But the way you have the data is not allowing you to achieve what you are looking for. Then what is the use of data source which you currently have?
Regards,
Rao.
Regards,
Rao.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-28-2019
01:59 AM
03-28-2019
01:59 AM
Rao - Can you suggest right solution for my requirements
I have data in Excel sheet. Rows can change for each call to the request. Sometimes I get 2 lines and sometimes I get 3 lines.
I want to ready and pass data from Excel sheet and dynamically created nodes in XML in one message itself
Message Example
Header
......
Nodes
< Item no = ? >
< Batch number =?>
Nodes elements should be dynamically added based on number of rows in Excel
Please advise
Thanks
Sameer Kaushik
I have data in Excel sheet. Rows can change for each call to the request. Sometimes I get 2 lines and sometimes I get 3 lines.
I want to ready and pass data from Excel sheet and dynamically created nodes in XML in one message itself
Message Example
Header
......
Nodes
< Item no = ? >
< Batch number =?>
Nodes elements should be dynamically added based on number of rows in Excel
Please advise
Thanks
Sameer Kaushik
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-28-2019
12:27 PM
03-28-2019
12:27 PM
Rao - Please advise the solution for my requirements.
I need to read data from Excel and then create child XML nodes based on number of rows in Excel which will be dynamic
I need to read data from Excel and then create child XML nodes based on number of rows in Excel which will be dynamic
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-01-2019
08:11 PM
04-01-2019
08:11 PM
Rao - Any update or advice you can provide on above
Sameer Kaushik
Sameer Kaushik
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-03-2019
04:45 AM
04-03-2019
04:45 AM
Hi skaushik9,
The DataSource Loop isn't helpful here. If you use it the request is sent each time when you iterate through rows.
You can do the following:
1. Continue using the Excel file as a source, but use a Groovy script to read the data from it.
2. Store the data in the XML file. In this case, you will be able to use the DataSource of the Directory (xml) or File (txt) type to read all the content and write to one property.
Please see the screenshots:
DataSource - Directory
DataSource - File
Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️
