Forum Discussion

DaveyBoy's avatar
DaveyBoy
New Contributor
3 years ago

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.

  • 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

3 Replies

  • richie's avatar
    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
    • DaveyBoy's avatar
      DaveyBoy
      New Contributor

      Thanks Richie.

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