How do I set up a Success String that is XML?

XML can be a bit tricky to set up correctly, but here's a detailed explanation of an near real world example:

Let's say you this is the response you receive:

<?xml version="1.0" encoding="utf-8"?> 
<collegepostresponse xmlns:xsi="" xmlns:xsd="" xmlns=""> 

This is the correct configuration with the treat response as XML checkbox selected:

Success POST String:  true

XML Response XPath: //x:collegepostresponse/x:accepted

Here's a fairly technical explanation of why we do it this way:

The trick with this xml response is that it is overriding the default xml namespace. As a result, you can't just use the // and / XPath operators. So as a workaround we add an alias "x" for the namespace.  The result is the appropriate xpath for the "accepted" tag is "//x:collegepostresponse/x:accepted"

In the collegepostresponse tag, you see all of the namespaces. The named ones are "xmlns:xsi" and "xmlns:xsd", which can be referenced via XPath as "xsi:" and "xsd:". The one without a name overrides the normal behaviour for unnamed path references, and it leaves no way to refer to the correct thing.  So, the "x:" alias allows you to refer to the overridden namespace.

Was this article helpful?
1 out of 1 found this helpful
Have more questions? Submit a request


Powered by Zendesk