Forum Discussion

piyu_sarda's avatar
piyu_sarda
Occasional Contributor
10 years ago

On property transfer, getting invalid JSON although is valid & response is printed in the JSON tab

Hi ,

 

I have posted this issue earlier as well but did not get a solution to this problem. Hence reposting the same.

 

I have created a sample project for the error. On hitting the request, i am able to see the JSON Response getting printed on the JSON tab. But when i am trying to extract a property, SOAP UI is throwing an error. I have attached screenshots of both the steps here. I have tried using groovy script as it was suggested on my earlier post but no luck.

 

PFA the sample project with the JSON response as well. 

 

It looks like a bug to me but if someone could please help, that would be really helpful.

 

Regards,

Piyu

  • nmrao's avatar
    nmrao
    Champion Level 3
    The reason is simple. It is because, the http header 'Content-Tye' is not coming as expected i.e., 'application/json; charset=UTF-8'
    • piyu_sarda's avatar
      piyu_sarda
      Occasional Contributor

      Hi Rao,

       

      In the application I am going to automate will contain the collection json as the content type. Also if you notice in the screenshot the JSON is picked up properly and shown under JSON tab, so the response is processed properly. In the JSON response i have attached, there is an empty line at the top. If I remove that, it all works properly with the same content type and does not throw an error on property transfer. 

       

      There should be an option in SOAP UI to process the response by stripping the empty spaces before and after the JSON as it can be done with the request. It should not restrict the downstream components for the empty spaces.

       

      Could you please check this?

       

      Thanks,

      Piyu

      • nmrao's avatar
        nmrao
        Champion Level 3
        1. If that is case, have you checked with the concerned developer to find why an empty line is coming in the response which I believe is the right way to address the problem as that is making the response invalid.

        2. Of course, you can handle such response in soapUI as well, but treat this as only making a workaround. To do that, you can have a script assertion, so that it won't affect your existing test steps as well.