digitalpacman
14 years agoOccasional Contributor
Cannot get JSON/JSONP value inside property transfer
Hello,
So everywhere I look people are scripting their tests instead of using the GUI.
I am using the GUI.
The API I am testing requires pre-authentication.
So I made a test that authenticates, JSON is returned that contains a token.
The response of the REST Test Request is:
Then directly after that test, I put a Property Transfer.
In the property transfer, I selected the dropdown for the request I just tested, and the property "Response".
In the source window I have tried:
//AuthToken
//AuthToken[1]
//Response/AuthToken
//Response/AuthToken[1]
In the target window I chose from the dropdown Properties (I made this as the first step to create a var) with the property option "token".
Then I run the request test, then I run the property transfer and I get the error:
Wed Feb 15 14:36:13 CST 2012 gettoken [error: Unexpected element: CDATA]
Note:
In the pro version the "XML element chooser" (top right of the source code box) says that it could not xpath the text. The text is in JSON.
If I go to the request, and click the JSON tab, it shows the json, and the XML tab shows the XML. Which is where I got the XML from above.
So everywhere I look people are scripting their tests instead of using the GUI.
I am using the GUI.
The API I am testing requires pre-authentication.
So I made a test that authenticates, JSON is returned that contains a token.
The response of the REST Test Request is:
<Response xmlns="http://api.localhost.com/health/authtoken">
<AuthToken>2b1c098a-20aa-4300-a8ae-7307fc73abbd</AuthToken>
<ExpiresOn>/Date(1360871516349-0600)/</ExpiresOn>
</Response>
Then directly after that test, I put a Property Transfer.
In the property transfer, I selected the dropdown for the request I just tested, and the property "Response".
In the source window I have tried:
//AuthToken
//AuthToken[1]
//Response/AuthToken
//Response/AuthToken[1]
In the target window I chose from the dropdown Properties (I made this as the first step to create a var) with the property option "token".
Then I run the request test, then I run the property transfer and I get the error:
Wed Feb 15 14:36:13 CST 2012 gettoken [error: Unexpected element: CDATA]
Note:
In the pro version the "XML element chooser" (top right of the source code box) says that it could not xpath the text. The text is in JSON.
If I go to the request, and click the JSON tab, it shows the json, and the XML tab shows the XML. Which is where I got the XML from above.