[RE-OPENED]SoapUI Pro changing response of xml document within xml document
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-01-2009
08:52 AM
10-01-2009
08:52 AM
[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
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:
The raw data that is coming back looks like this (and is well-formed):
Thanks,
Mary
40 REPLIES 40
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-02-2009
06:33 AM
10-02-2009
06:33 AM
Hi,
That sounds like what I need. If you could create an example for me, that would be great. I'll give it a try and let you know how it works out.
Thanks,
Mary
That sounds like what I need. If you could create an example for me, that would be great. I'll give it a try and let you know how it works out.
Thanks,
Mary
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-05-2009
01:40 AM
10-05-2009
01:40 AM
Hi,
Did you get a chance to create an example that I can try out?
Thanks,
Mary
Did you get a chance to create an example that I can try out?
Thanks,
Mary
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-05-2009
06:36 AM
10-05-2009
06:36 AM
Hi Mary,
sorry for the delay, I'm working on it right now.. can you (once again) show me the raw response returned by your server?
regards!
/ole
eviware.com
Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️
sorry for the delay, I'm working on it right now.. can you (once again) show me the raw response returned by your server?
regards!
/ole
eviware.com
Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-05-2009
07:06 AM
10-05-2009
07:06 AM
Hi,
Here is the raw response for that same service:
<?xml version="1.0" encoding="UTF-8"?><SkillPort><BaseSite><WebsiteColors CurrentColor="#FFFFFF" DefaultColor="#FFFFFF" ModifiedByServer="vmhapi" ModifiedByUser="-1" ModifiedDate="2009-10-02 15:05:54.583" Name="COLOR_LOGIN_DIALOG_BUTTON_TEXT"/></BaseSite><AdvancedGroup Name="AGHapi" Orgcode="AGHapi"><WebsiteColors CurrentColor="#FFFFFF" DefaultColor="#FFFFFF" ModifiedByServer="vmhapi" ModifiedByUser="-1" ModifiedDate="2009-10-02 16:12:54.737" Name="COLOR_LOGIN_DIALOG_BUTTON_TEXT"/></AdvancedGroup><AdvancedGroup Name="test" Orgcode="123456_-"><WebsiteColors CurrentColor="#FFFFFF" DefaultColor="#FFFFFF" ModifiedByServer="vmhapi" ModifiedByUser="-1" ModifiedDate="2009-10-02 18:42:57.857" Name="COLOR_LOGIN_DIALOG_BUTTON_TEXT"/></AdvancedGroup></SkillPort>
Thanks,
Mary
Here is the raw response for that same service:
Thanks,
Mary
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-05-2009
08:00 AM
10-05-2009
08:00 AM
Hi Mary,
thank you.
Ok.. try adding a SubmitListener.afterSubmit handler to your project (in the Project/Events tab);
This should change the response internally in soapUI so that the contained xml document is seen as xml and not as a string.
Tell me how it works!
regards,
/Ole
eviware.com
Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️
thank you.
Ok.. try adding a SubmitListener.afterSubmit handler to your project (in the Project/Events tab);
if( submit.response == null )
return
def content = submit.response.responseContent
content = content.replaceAll( "<", "<" )
content = content.replaceAll( ">", ">" )
submit.response.responseContent = content
This should change the response internally in soapUI so that the contained xml document is seen as xml and not as a string.
Tell me how it works!
regards,
/Ole
eviware.com
Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-05-2009
08:38 AM
10-05-2009
08:38 AM
Hi Ole,
I added the SubmitListener.afterSubmit handler. I am still getting the CDATA tags after I submit the request. Here is the response as it appears on the XML tab after the listener was added.
<?xml version="1.0" encoding="UTF-8"?><SkillPort><BaseSite><WebsiteColors CurrentColor="#FFFFFF" DefaultColor="#FFFFFF" ModifiedByServer="vmhapi" ModifiedByUser="-1" ModifiedDate="2009-10-02 15:05:54.583" Name="COLOR_LOGIN_DIALOG_BUTTON_TEXT"/></BaseSite><AdvancedGroup Name="AGHapi" Orgcode="AGHapi"><WebsiteColors CurrentColor="#FFFFFF" DefaultColor="#FFFFFF" ModifiedByServer="vmhapi" ModifiedByUser="-1" ModifiedDate="2009-10-02 16:12:54.737" Name="COLOR_LOGIN_DIALOG_BUTTON_TEXT"/></AdvancedGroup><AdvancedGroup Name="test" Orgcode="123456_-"><WebsiteColors CurrentColor="#FFFFFF" DefaultColor="#FFFFFF" ModifiedByServer="vmhapi" ModifiedByUser="-1" ModifiedDate="2009-10-02 18:42:57.857" Name="COLOR_LOGIN_DIALOG_BUTTON_TEXT"/></AdvancedGroup></SkillPort>
Any other ideas? What exactly needs to be removed/added?
Mary
I added the SubmitListener.afterSubmit handler. I am still getting the CDATA tags after I submit the request. Here is the response as it appears on the XML tab after the listener was added.
Any other ideas? What exactly needs to be removed/added?
Mary
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-05-2009
08:44 AM
10-05-2009
08:44 AM
Hi Mary,
hmm.. please add
log.info content
at the end of the handler, which will write the content to the script log.. can you check what it is writing there?
regards,
/Ole
eviware.com
Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️
hmm.. please add
log.info content
at the end of the handler, which will write the content to the script log.. can you check what it is writing there?
regards,
/Ole
eviware.com
Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-05-2009
08:53 AM
10-05-2009
08:53 AM
Hi Ole,
This is what is writing to the script log after adding the log.info content:
Mon Oct 05 11:52:27 EDT 2009:INFO:
<?xml version="1.0" encoding="UTF-8"?><SkillPort><BaseSite><WebsiteColors CurrentColor="#FFFFFF" DefaultColor="#FFFFFF" ModifiedByServer="vmhapi" ModifiedByUser="-1" ModifiedDate="2009-10-02 15:05:54.583" Name="COLOR_LOGIN_DIALOG_BUTTON_TEXT"/></BaseSite><AdvancedGroup Name="AGHapi" Orgcode="AGHapi"><WebsiteColors CurrentColor="#FFFFFF" DefaultColor="#FFFFFF" ModifiedByServer="vmhapi" ModifiedByUser="-1" ModifiedDate="2009-10-02 16:12:54.737" Name="COLOR_LOGIN_DIALOG_BUTTON_TEXT"/></AdvancedGroup><AdvancedGroup Name="test" Orgcode="123456_-"><WebsiteColors CurrentColor="#FFFFFF" DefaultColor="#FFFFFF" ModifiedByServer="vmhapi" ModifiedByUser="-1" ModifiedDate="2009-10-02 18:42:57.857" Name="COLOR_LOGIN_DIALOG_BUTTON_TEXT"/></AdvancedGroup></SkillPort>
This is what is writing to the script log after adding the log.info content:
Mon Oct 05 11:52:27 EDT 2009:INFO:
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-05-2009
08:57 AM
10-05-2009
08:57 AM
Hi!
ah.. ok.. so try modifying the script to be:
Now what happens?
Thanks for bearing with me..
/Ole
eviware.com
Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️
ah.. ok.. so try modifying the script to be:
if( submit.response == null )
return
def content = submit.response.responseContent
content = content.replaceAll( "<", "<" )
content = content.replaceAll( ">", ">" )
content = content.replaceAll("<![CDATA[<\\?xml version=\"1\\.0\" encoding=\"UTF-8\"\\?>", "" )
content = content.replaceAll( "]]>", "" )
log.info content
submit.response.responseContent = content
Now what happens?
Thanks for bearing with me..
/Ole
eviware.com
Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-05-2009
09:11 AM
10-05-2009
09:11 AM
Hi Ole,
I get this in my SoapUI log:
Mon Oct 05 12:08:16 EDT 2009:ERROR:java.util.regex.PatternSyntaxException: Illegal character range near index 45
<\?xml version="1\.0" encoding="UTF-8"\?><br /> ^<br /><br />Thanks,<br /><br />Mary
I get this in my SoapUI log:
Mon Oct 05 12:08:16 EDT 2009:ERROR:java.util.regex.PatternSyntaxException: Illegal character range near index 45
<\?xml version="1\.0" encoding="UTF-8"\?><br /> ^<br /><br />Thanks,<br /><br />Mary
