Forum Discussion

NYefimov's avatar
NYefimov
Occasional Contributor
17 years ago

issue with saving xml request

Ole,

after I modify XML request in a test case and save it, close SoapUI, open SoapUI again the changes that I made stay there. This is OK. I deleted 2 elements and did not find them in xml request after I close-open soapUI.
But I found out that 1 more element is deleted, the one that I did not touch. It is reproducable (I did it a few times), the element was always the same ().
Any suggestions?

Apart of this how would you right a groovy script that first checks the existance of an element in XML request and if it's NULL adds it as a child to the parent under which you checked the existance.
Say the element name is . It is a child of .
The xml request is below:


       
           
           
            TC_LSD_05_1_04_GetProgramDetails_Broadcast_ServiceId
           
           
            en-US
            783882
            <metadata>All

           
           
            3
           
           
            3
           
           
            PlainText
           
           
            20530
           
           
            2007-09-12T01:44:33Z
           
           
            20160
           
           
            false
           
           
             
                 
                 
                 
             

             
              HD
             
             
                 
                 
                  Music
             

           

       

     

 



Thanks,
Nick

2 Replies

  • omatzura's avatar
    omatzura
    Super Contributor
    Hi Nick,

    strange.. I can't reproduce this... can you mail me your project-file so I can try with it locally?

    Regarding the check, you could do something like the following:

    // check for node
    node = holder.getDomNode( "//lis:PGID" )

    // not there?
    if( node == null )
    {
      // get parent
      node = holder.getDomNode( "//lis:request" )

      // create new element
      def elm = node.ownerDocument.createElementNS( "http://services.tvguide.com/v2.5/listings", "PGID" )

      // add it to parent
      node.appendChild( elm )

      // create text content
      elm.appendChild( node.ownerDocument.createTextNode( "testing text" ))
    }

    The tricky part above is to insert the node into the right position (In my example I just appended it..), you would first have to find the node to insert before and then use node.insertBefore( .. ) instead of node.appendChild..

    What you could do is generate XMLBeans for your wsdl (using the integrated XMLBeans wizard), add the generated jar to soapui\bin\ext, and then use these to manipulate the request.. they would make this much easier. Let me know if that is of interest and I'll prepare an example for you next week..

    best regards!

    /Ole
    eviware.com
  • NYefimov's avatar
    NYefimov
    Occasional Contributor
    Hi Ole,

    the first part somehow disappeared.
    It persisted yesterday. I reproduced it a few times and even showed it to my peer because I thought it is strange.

    second part looks good!
    I will implement it if the problem persists.

    Thanks