Ask a Question

SOAP UI 5.2 is throwing JSON invalid error while property transfer although JSON is valid

SOLVED
piyu_sarda
Occasional Contributor

SOAP UI 5.2 is throwing JSON invalid error while property transfer although JSON is valid

Hi,

I am getting proper collection JSON response as part of Rest API call. I have validated it using jsonlint.com. But when i am performing a property transfer from Response to next request, SOAP UI 5.2 gives me invalid JSON.

 

Could anyone please help? I have attached only the structure of my JSON response and have removed the values.

 

Thanks

16 REPLIES 16
nmrao
Community Hero

What values you need out of it?


Regards,
Rao.
TanyaYatskovska
SmartBear Alumni (Retired)

Hi Piyu_sarda,

 

If you provided us with a sample project where this issue is reproduced, I would pass it to our Dev Team so that they could investigate this.

 

---------
Tanya Yatskovskaya
SmartBear Community and Education Manager



nmrao
Community Hero

May be you can use script assertion to see if that works as posted in

http://community.smartbear.com/t5/SoapUI-Open-Source/View-Assertion-Value-in-SoapUI/m-p/105064#U1050...

 

You may need, additionall statement, to set the test case property in order to be able to use the retrieved value from the response to other steps

 

If you look at the above thread value retrieved is in expectedValue variable.

 

The same value is need another (from your description as you are doing property transfer), add below line of code at the end:

context.testCase.setPropertyValue('PROPERTY_NAME', expectedValue)

and use property expansion in the later steps as ${#TestCase#PROPERTY_NAME}



Regards,
Rao.
piyu_sarda
Occasional Contributor

Hi ,

 

I should be able to extract any value. For now you can look into href element under collection.

 

Thanks

Have you looked into the sample provided



Regards,
Rao.
migueleis
New Contributor

I have same problem getting properties from JSON with SoapUI 5.2.0. This is my response object 

{
"code": 0,
"message": "OK",
"sessionId": "3122d0bd-9f21-400a-b95d-87217adeab02"
}

 

When try to get one of them from property tranfer (Property: ResponseAsXml; Path language: JSONPath) I have error: 

 

Mon Sep 21 13:42:34 CEST 2015 sessionID [Invalid JSON: <Response xmlns="http://localhost/...">
<code>0</code>
<message>OK</message>
<sessionId>3122d0bd-9f21-400a-b95d-87217adeab02</sessionId>
</Response>]

You can see the response as JSON. So, you may use the sample provided to extract the value using script assertion.


Regards,
Rao.
migueleis
New Contributor

Finally I succeeded with this configuration.

 

Thanks.

Glad to know.


Regards,
Rao.
cancel
Showing results for 
Search instead for 
Did you mean: