Forum Discussion

trivenim's avatar
trivenim
Occasional Contributor
9 years ago
Solved

SoapUI 5.2.1-REST Service's JSON response not displayed in JSON view

Hi,

 

When I execute REST service in Soap UI 5.2.1 Open source, the respective JSON response is not displayed in JSON view and instead below message is displayed.

 

"The content you are trying to view cannot be viewed as JSON".

 

Please suggest me if I have to change SoapUI settings to see JSON response in JOSON view

 

Please find below other views that I see.

 

XML View:

 

<data contentType="text/plain;charset=ISO-8859-1" contentLength="140"><![CDATA[{"status":{"resultCod​e":0,"developerMessage":"Hint question retrived successfully [Time Taken: 1103 millisec]"},"data":{"hintQuestion":"7"}}]]></data>

 

HTML View:

 

{"status":{"resultCode":0,"developerMessage":"Hint question retrived successfully [Time Taken: 1103 millisec]"},"data":{"hintQuestion":"7"}}

 

 

Raw view:

 

HTTP/1.1 200 OK
Date: Mon, 09 Nov 2015 20:57:50 GMT
Content-Type: text/plain;charset=ISO-8859-1
X-Powered-By: Servlet/2.5 JSP/2.1
Set-Cookie: JSESSIONID=RF4JWBHpJvGVGQmnGqDlyTP2121pBQgVpn2sf8P​tQJsDBFT5TYMf!1112697720; path=/; HttpOnly
Set-Cookie: sto-id-16671=GCJIKIMAEBBP; Expires=Mon, 09-Nov-2015 21:23:10 GMT; Path=/
Connection: close
Transfer-Encoding: chunked
Set-Cookie: nwp_1-47873-%3FVFSIN_PUB%3Fsg_nhlweb_qa1_8080=BPJG​KIMAJABP; Expires=Mon, 09-Nov-2015 21:32:10 GMT; Path=/

{"status":{"resultCode":0,"developerMessage":"Hint question retrived successfully [Time Taken: 1103 millisec]"},"data":{"hintQuestion":"7"}}

 

  • I'm not sure about the exact cause; but, I guess the issue is with the response Content-Type which holds "text/plain;charset=ISO-8859-1". Hence, SoapUI doesn't detects in the JSON response viewer.I just tried with one of my REST service and SoapUI displayed perfect JSON view with the Content-Type - application/json

     

     

    HTTP/1.1 200 OK
    Content-Type: application/json; charset=UTF-8
    Date: Tue, 10 Nov 2015 03:37:56 GMT
    Expires: Wed, 11 Nov 2015 03:37:56 GMT

    When I tried to reproduce your scenario, with response Content-Type as "text/plain", the JSON response viewer displays "The content you are trying to view cannot be viewed as JSON".

     

    As suggested by nmrao, please check with the service provider to match the Content-Type that suits with Front-end application.

     

    Thanks,

    Samy

     

    Did my reply answer your question? Give Kudos or Accept it as a Solution to help others, Thanks. ↓↓↓

     

  • nmrao's avatar
    nmrao
    9 years ago
    I think the value which was to Content-Tye may not valid. i.e., application/Json instead of application/json; charset=UTF-8, charset can be whatever supported. Could be an issue with case sensitivity(Your case it is Capital Json instead of all small json)

13 Replies

  • kondasamy's avatar
    kondasamy
    Regular Contributor

    I'm not sure about the exact cause; but, I guess the issue is with the response Content-Type which holds "text/plain;charset=ISO-8859-1". Hence, SoapUI doesn't detects in the JSON response viewer.I just tried with one of my REST service and SoapUI displayed perfect JSON view with the Content-Type - application/json

     

     

    HTTP/1.1 200 OK
    Content-Type: application/json; charset=UTF-8
    Date: Tue, 10 Nov 2015 03:37:56 GMT
    Expires: Wed, 11 Nov 2015 03:37:56 GMT

    When I tried to reproduce your scenario, with response Content-Type as "text/plain", the JSON response viewer displays "The content you are trying to view cannot be viewed as JSON".

     

    As suggested by nmrao, please check with the service provider to match the Content-Type that suits with Front-end application.

     

    Thanks,

    Samy

     

    Did my reply answer your question? Give Kudos or Accept it as a Solution to help others, Thanks. ↓↓↓

     

    • trivenim's avatar
      trivenim
      Occasional Contributor

      Hi Kondasamy,

       

      Thank you so much for your inputs:)

      Yes, clearly issue is with content-Type. With your reply, that got confirmed as you were able to see JSON view for your REST services.

       

      I approached my dev team to make necessary code changes to solve this issue on our end. 

    • IBaxter's avatar
      IBaxter
      Occasional Contributor

      I just got the same problem.

      Content-Type: application/Json

      and I was able to see my response in json viewer with no problem.

      But Ready API 1.5 gave me 'The content you are trying to view cannot be viewed as JSON'

      • kondasamy's avatar
        kondasamy
        Regular Contributor

        If possible, could you please share the raw response or atleast a screenshot covering the response's header part.

         

        Thanks,

        Samy

  • nmrao's avatar
    nmrao
    Champion Level 3
    I believe, you should check with the service provider/developer for the supported formats i.e., xml/json
    • trivenim's avatar
      trivenim
      Occasional Contributor

      Hi nmrao,

       

      Thanks for your valuable reply. Got confirmation from developer that supported format is JSON.