Ask a Question

[RE-OPENED]SoapUI Pro changing response of xml document within xml document

skillsoft
Frequent Contributor

[RE-OPENED]SoapUI Pro changing response of xml document within xml document

Is there an preference I can set or some other way to have it so SoapUI Pro is not modifying the response when it is interpreting the XML from the raw data? 

We have an API whos response returns an xml document within an xml document.  It looks like SoapUI is attempting to decode that XML and trying to represent a document within a document, which results in non well-formed XML which it puts CDATA tags around. This non well-formed XML ends up looking like this:


   
     
         <?xml version="1.0" encoding="UTF-8"?><SkillPort><BaseSite><WebsiteColors CurrentColor="#FFFFFF" DefaultColor="#FFFFFF" ModifiedByServer="vmhapi" ModifiedByUser="-1" ModifiedDate="2009-09-29 17:34:38.68" Name="COLOR_LOGIN_DIALOG_BUTTON_TEXT"/></BaseSite><AdvancedGroup Name="AGHapi" Orgcode="AGHapi"><WebsiteColors CurrentColor="#FFFFFF" DefaultColor="#FFFFFF" ModifiedByServer="vmhapi" ModifiedByUser="-1" ModifiedDate="2009-10-01 10:03:22.68" Name="COLOR_LOGIN_DIALOG_BUTTON_TEXT"/></AdvancedGroup></SkillPort>
     

   


The raw data that is coming back looks like this (and is well-formed):

<?xml version="1.0" encoding="UTF-8"?><SkillPort><BaseSite><WebsiteColors CurrentColor="#FFFFFF" DefaultColor="#FFFFFF" ModifiedByServer="vmhapi" ModifiedByUser="-1" ModifiedDate="2009-09-29 17:34:38.68" Name="COLOR_LOGIN_DIALOG_BUTTON_TEXT"/></BaseSite><AdvancedGroup Name="AGHapi" Orgcode="AGHapi"><WebsiteColors CurrentColor="#FFFFFF" DefaultColor="#FFFFFF" ModifiedByServer="vmhapi" ModifiedByUser="-1" ModifiedDate="2009-10-01 10:03:22.68" Name="COLOR_LOGIN_DIALOG_BUTTON_TEXT"/></AdvancedGroup></SkillPort>

Thanks,

Mary
40 REPLIES 40
SmartBear_Suppo
SmartBear Alumni (Retired)

Hi Mary,

from what I can see the response returned by soapUI is just as well-formed as the original raw data; instead of entitizing all '>' and '<' it has surrounded the contained xml document with a CDATA syntax, which is just another way of escaping xml within xml.

Are you getting errors related to this somehow?

regards!

/Ole
eviware.com

Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️
skillsoft
Frequent Contributor

I am not getting any error unless I remove the CDATA tags, then it is not well-formed.  I understand that this is just another way of escaping XML within XML, but being QA I'd rather be able to verify the actual response and if SoapUI is deciding to change it in such a way I don't have the confidence that is correct and have to end up using other tools to do this verification as the text within the CDATA tags is ignored by the parser.  Also, CDATA is much harder to deal with in SoapUI.  The values that will be returned will be changing depending on what the corresponding "set" web service is setting.

Do you have any suggestions or workarounds for this issue? 

Mary
SmartBear_Suppo
SmartBear Alumni (Retired)

Hi!

hmm.. what happens if you turn off pretty-printing of the response?

regards!

/Ole
eviware.com

Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️
skillsoft
Frequent Contributor

If I turn of pretty printing I get the raw xml returned.  Are those my only choices CDATA or raw xml? Do you have any suggestions other than that?  This looks to be a defect in SoapUI and unfortunately will be a huge issue for us as half our testing involves similar API's to this.

I would prefer to have it display something like this which is what others are seeing through Java, .NET:


 
     
       
       
         
           
         

         
           
         

       

     

     

 


Thanks,

Mary
SmartBear_Suppo
SmartBear Alumni (Retired)

Hi!

hmm.. so if I understand you correctly this is related to the actual viewing of the response? What about the overview view in the response tab, how does that show this response? Can you attach a screenshot?

regards!

/Ole
eviware.com

Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️
skillsoft
Frequent Contributor

Now that I've had more time to look at this outside of work hours if I pretty print the xml response and convert the text to xml using NotePad++ with the XML plugin (or numerous other tools) I get something that looks like this (and this is what I need to see):










What I see on the XML tab of SoapUI is something that looks like this:


 
     
        <?xml version="1.0" encoding="UTF-8"?><SkillPort><BaseSite><WebsiteColors CurrentColor="#FFFFFF" DefaultColor="#FFFFFF" ModifiedByServer="vmhapi" ModifiedByUser="-1" ModifiedDate="2009-10-01 18:56:09.207" Name="COLOR_LOGIN_DIALOG_BUTTON_TEXT"/></BaseSite><AdvancedGroup Name="AGHapi" Orgcode="AGHapi"><WebsiteColors CurrentColor="#FFFFFF" DefaultColor="#FFFFFF" ModifiedByServer="vmhapi" ModifiedByUser="-1" ModifiedDate="2009-10-01 18:56:09.207" Name="COLOR_LOGIN_DIALOG_BUTTON_TEXT"/></AdvancedGroup></SkillPort>
     

 


Is it possible to do what I need in SoapUI or is there a workaround (3rd time asking this question)? If you can't answer this question, can you pass this on to someone who can?  Again, this is a huge issue for us and we are in the process of testing these APIs. 

Thanks,

Mary
SmartBear_Suppo
SmartBear Alumni (Retired)

Hi!

you have to understand the document you are getting in notepad++, etc is not the same as the original one; the embedded xml-string has been converted into actual XML and this is not something that soapUI does (or should do) by default.

Of course there are workarounds but to suggest the correct one I need to know what you actually want/need to do:
- be able to view the XML as you showed in the last post in the XML view? So you can add assertions?
- Or what if we fix the overview tab (in your screenshot) to pretty-print the xml instead of showing it in one long string?

let me know!

regards,

/Ole
eviware.com

Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️
skillsoft
Frequent Contributor

If you are not converting the raw xml into actual xml, what exactly is SoapUI doing on the XML tab?  I need to understand this.

The xml response contains alot of database and server specific information and date/times.  We need to be able to wildcard just those values in the assertions.

This API is currently only returning 1 color (which is a defect in our product), but when it is works correctly it will return all the web site colors (53 in total).  I would like to be able to get the web site colors (identified by the name= attribute) from this response and use them (changing one or 2 colors) in the  "set" request.  All the API's return different info, but the process would be similar. 

I'm not really concerned with display on the overview tab, I'm more concerned with being able to use functionality built into SoapUI Pro to do the assertions, property transfers.  I am limited to only doing that with the return element in the response, and not the elements/attributes within the return element in it's current form. We are on a tight schedule so we don't have a lot of time to do much in the way of groovy scripting, but we could do a limited amount if it is necessary.

How would I do what I want?

Thanks,

Mary
SmartBear_Suppo
SmartBear Alumni (Retired)

Hi!

soapUI is converting the raw response message XML to xml.. but the contained xml result in your response is just a string and not xml, and will thus not be converted to XML. If you need to change the content of the document so that soapUI will view it entirely as XML (even the string content), you can use an EventHandler for this to convert the raw response into something that you can handle as you want to. If thats sounds like what you need, I can create an example for you.. let me know!

regards,

/Ole
eviware.com

Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️
cancel
Showing results for 
Search instead for 
Did you mean: