Forum Discussion

stoeve's avatar
stoeve
New Contributor
16 years ago

REST View Problem in soapUI 2.5.1 (and nightly builds 2.5.2)

Hi all,

I call a rest service and the result is a json string. The result is not identified as "json".  In the json tab there is just a message . Any ideas?
Is the content-type necessary to detect the json answer?

Regards,
Jan

-----

The raw response looks like this:

HTTP/1.0 200 OK
Date: Tue, 12 May 2009 12:35:43 GMT
Server: Apache/2.2.3 (Linux/SUSE)
Vary: Accept-Encoding
Content-Type: text/plain
Proxy-Connection: close

{ "userlessons" : [ {  "id" : 1,  "description" : "Basiswortschatz (Deutsch-Spanisch)",  "title" : "DE-ES",  "type" : 0,  "showPinyin" : true,  "available" : 534 } , {  "id" : 3,  "description" : "Basiswortschatz (Spanisch-Deutsch)",  "title" : "ES-DE",  "type" : 0,  "showPinyin" : true,  "available" : 750 } , {  "id" : 53,  "description" : "Aktuelle deutsche Politiker (Stand 10.02.2009)",  "title" : "POL",  "type" : 0,  "showPinyin" : true,  "available" : 16 } , {  "id" : 55,  "description" : "Hauptstädte in Europa",  "title" : "CAP-EUR",  "type" : 0,  "showPinyin" : true,  "available" : 13 } , {  "id" : 76,  "description" : "Basiswortschatz (Deutsch-Englisch)",  "title" : "BAS-DE-EN",  "type" : 0,  "showPinyin" : true,  "available" : 441 } , {  "id" : 328,  "description" : "HanDeDict HSK Stufe A (Chinesisch/Pinyin - Deutsch)",  "title" : "HSK-A-DE",  "type" : 1,  "showPinyin" : false,  "available" : 82 } , {  "id" : 472,  "description" : "New Practical Chinese Reader (Book 1)",  "title" : "NPCR-1",  "type" : 1,  "showPinyin" : true,  "available" : 44 }  ] }
  • Hi stoeve,


    Current implementation of REST support in soapUI would accept response entity data as JSON if Content-Type contains either "javascript" or "json".
    Regardless of that, your JSON data sources should prefer using Content-type: application/json since it is the official media type registered at IANA.


    Cheers!
    /Nenad Nikolic a.k.a. Shonzilla
  • stoeve's avatar
    stoeve
    New Contributor
    Hi Shonzilla,

    thanks for the reply. I changed the content type and everything works fine now.

    Regards,
    Jan