Ask a Question

ReadyAPI XML Creation (for Radar Live) to ignore empty Elements without Values

SOLVED
DaveyBoy
New Contributor

ReadyAPI XML Creation (for Radar Live) to ignore empty Elements without Values

Hi, I'm a newbie to ReadyAPI but with lots of experience around XML and Dev. We use ReadyAPI to create XML's from Excel to fire at Radar Live. Whilst designing the 'Soap Request' XML, is there a way to only Output the XML Element if there is a value present? I have a 'multi instance' block of data but only want the blocks containing data to be built during the XML creation phase. 

I would like to stop below happening...

<MultiInstances>
   <Tent_Details>
      <Tent_ID value="1"/>
      <Tent_Manufacture value="Smith"/>
   </Tent_Details>
   <Tent_Details>
      <Tent_ID value="2"/>
      <Tent_Manufacture value="Jones"/>
   </Tent_Details>
   <Tent_Details>
      <Tent_ID value=""/>
      <Tent_Manufacture value=""/>
   </Tent_Details>
   <Tent_Details>
      <Tent_ID value=""/>
      <Tent_Manufacture value=""/>
   </Tent_Details>
</MultiInstances>

 

Any help would be appreciated.

3 REPLIES 3
richie
Community Hero

Hey @DaveyBoy,

How are you creating your SOAP services in ReadyAPI, are you creating a project directly from the .wsdl?

This wont stop empty elements being generated, but it will completely minimise the effort of creating the payloads as the test steps in ReadyAPI are child records linked from the APIs you create.

If you dont want empty elements you could use the datasource functionality (and hard code all your payloads in either one or multiple external files), but this seems like a lot of effort you dont need to bother with if importing the .wsdl first

Cheers

Rich
if this helped answer the post, could you please mark it as 'solved'? Also if you consider whether the title of your post is relevant? Perhaps if the post is solved, it might make sense to update the Subject header field of the post to something more descriptive? This will help people when searching for problems. Ta
sonya_m
SmartBear Alumni (Retired)

Thanks a lot, Richie!

 

@DaveyBoy does the advice help?


Sonya Mihaljova
Community and Education Specialist

Thanks Richie.

Although I did not follow exactly what you had said, it pointed me in the right direction. Many Thanks.

cancel
Showing results for 
Search instead for 
Did you mean: