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
piyu_sarda
Occasional Contributor

Hi Rao,

Sorry I could not reply earlier.I have looked at your answer and i tried it using groovy but it still says invalid JSON. I was completely lost after and tried various permutations.

 

After banging my head for a good number of hours, finally I came to know the root cause of this silly issue. The response JSON contains a empty line at the top which SOAP UI is not able to process. Although the JSON view of Response in the Test Step shows a valid JSON but when performing a property transfer, it looks like it is picking up from raw response which has an empty line at the top. My dev team is not going to definitely fix this in a shorter term as the our APIs are used by other applications and no one complained about it.

 

Is there a way in SOAP UI to get around it?

 

Thanks,

Piyu

 

Hi Tanya,

 

Finally after a good number of hours, I came to know the root cause of this issue. The response JSON contains a empty line at the top which SOAP UI is not able to process. Although the JSON view of Response in the Test Step shows a valid JSON but when performing a property transfer, it looks like it is picking up from raw response which has an empty line at the top. My dev team is not going to definitely fix this in a shorter term as the our APIs are used by other applications and no one complained about it.

 

Is there a way in SOAP UI to get around it? I have replicated this issue with a sample project. Do you still need it or the details are sufficient to replicate this?

 

Thanks,

Piyu

I would suggest you to discuss with your development team to findout why the response is invalid as soapUI can't do much to the invalid response sent by your application.



Regards,
Rao.
piyu_sarda
Occasional Contributor

Hi Rao,

 

Its not an invalid response. SOAP UI is able to process the response. Since it is able to parse and show the response in JSON view, it proves that response is valid. Its throwing an error only when trying to do a property transfer directly or via a groovy code. 

 

I have attached a simple json file which you can call from a sample project and try to extract a value using property transfer. It will show the JSON response in the view but property transfer will fail. So this definitely looks like a bug which needs to be fixed. If it was a problem with the response, then SOAP UI should not have picked up JSON in first place and display in JSON tab of response.

 

Could you please check again?

 

Regards,

Piyu

Earlier, in this thread, a link to the thread has been provided, which explains how to do what you are looking for (note that does not use property transfer, instead uses script assertion and sets required property at test case level, so that it can be used in the later test steps using property expansion. And I could not try with property transfer)

 

Give a try.



Regards,
Rao.
piyu_sarda
Occasional Contributor

Hi Rao,

 

I have already followed your suggestions of using script assertion but that does not work either. I think someone from SoapUI development team should look into this issue and fix it.

 

Thanks,

Piyu

Not sure what is the exact issue when you followed the suggestion.

 

Here is another exactly same case from here, i think you should be able to replace your required variables.

 

http://community.smartbear.com/t5/SoapUI-Open-Source/How-do-I-do-a-property-transfer-with-multiple-s...



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