Forum Discussion

digitalpacman's avatar
digitalpacman
Occasional Contributor
14 years ago

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:
CODE: SELECT ALL
<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.

8 Replies

  • M_McDonald's avatar
    M_McDonald
    Super Contributor
    Try 'ResponseAsXml' instead of 'Response' for the source property.
  • digitalpacman's avatar
    digitalpacman
    Occasional Contributor
    Thanks that worked!

    But now when I set an assertion, I get:
    <missing raw request data>

    Request log says:
    2012-02-28 18:02:17 - Error getting response; java.lang.IllegalArgumentException: Comparison method violates its general contract!

    It works as long as I don't have an assertion on the test that received the data.
  • digitalpacman's avatar
    digitalpacman
    Occasional Contributor
    It's just a simple must be 200 request assertion. Valid http response codes.
  • Hi

    hmm.. what kind of assertion did you add? Can you attach a screenshot of the error message?

    regards,

    /Ole
    SmartBear Software
  • Hi!

    Are there any error messages in the Error Log or soapUI Log? They would be useful for us to troubleshoot this.

    Also, do you have the possibility to try soapUI 4.5 beta2?

    Thanks

    Henrik
    SmartBear Software
  • I've got an additional question: Are you running soapUI with Java 7?

    If so, can you try the regular exe-installer of soapUI, which runs on a bundled Java 6?

    /Henrik
  • Update: This will be fixed in soapUI 4.5 final. You can fix it yourself now by setting the system property java.util.Arrays.useLegacyMergeSort.

    /Henrik