Forum Discussion
16 Replies
- ChrisAdamsChampion Level 3
Hi, without sounding obvious, is the service you're calling returning valid JSON? Have you checked the validity using an on-line checker?
- usamantOccasional ContributorThank you for your reply.
Postman gives valid json response for the same request.
As per the answer found when I googled, it is advised to set Content-Type
as application/json for response.
But then also I am getting same message instead of valid json response and
where as all other like xml, html and other format gives the response.
Your help is much appreciated.
Regards,
Umesh.. - usamantOccasional Contributor
Hi,
Problem still persists.
Tried every thing
1. Setting Accept header for application/json in request header
2. Setting Representation as c for Response.
3. Setting all Request headers as those are in Postman ( in Postman getting Json response without any setting)
1 thing noticed - Even after setting application/json as Representation of Response(Point 2) Raw tab shows Content-Type as text/html. Seems whatever is set is getting overwrite
Help here is much appreciated.
Thanks,
Umesh..
.
- ChrisAdamsChampion Level 3
Can you share any screenshots of the request or response?
- usamantOccasional Contributor
Please find Response Header - Content-Type. Am I missing any thing to set.
- ChrisAdamsChampion Level 3
Hi,
You might not be setting the headers correctly, but I cannot tell. Can you share screenshots of the raw tabs for the request and response?
In the request side, you need to define the headers. You may have done that already as I note you asked that as a separate question.
It would be nice to see the raw response. I know you said it works in Postman, but worth a look.
- usamantOccasional Contributor
Even after setting Content-Type application/json it is getting overwritten with text/html ( see the raw tab of response)
- richieCommunity Hero
Hey usamant
sorry - I think I responded the same time as ChrisAdams did and we had the same thoughts.
Looking at your RAW tab - you'd expect if there was any response payload content immediately beneath the headers list.
I can only see the top of the RAW in your screenshot - is there any payload content beneath the headers?
If there is no payload content beneath the headers list, then that's the reason for the lack of json content in your JSON tab - there is no payload in the response.
If there is content - can you screengrab the full details of the RAW tab please?
if there is no payload content and you're expecting it - then I'd suggest there something you need to sort (defect, etc.) at your end - this isn't a SoapUI issue by the look of things.
Cheers,
Rich
- richieCommunity HeroHey usamant,
Is the content of the response actually wellformed json? This is a guess on my part, but using xml as an analagous example, just declaring something as xml with 'application/xml' doesnt mean it is in fact xml. The rules around whats considered xml have relaxed over the years, but to be considered xml, it has to be wellformed (syntax rules). Perhaps json handling is similar?
What does the content in the RAW tab indicate?
Can you post a screengrab of your RAW tab?
Cheers,
Rich - ChrisAdamsChampion Level 3
Hi,
OK, based on the last two screenshots...
It works on Postman, so let's focus on that and why. Have a look at the headers you have defined for the Postman request (not the response). Once you can see those, in SoapUI click the headers tab in the request and make them match to the Postman headers.
Give that a go.
The bit that is striking is you don't appear to have any data returned when you use SoapUI. It may be the headers, but you should know by this point.
I'd also look at the gzip/deflate. It may be that SoapUI is zipping your request and the API cannot handle it. This might be a red-herring as the zipping is only for the request body, but worth looking at. Why? Well, an API I previously tested only accepted zipped payloads. This was fine in SoapUI/ReadyAPI but not Postman. Postman does not zip bodies. You have to compress outside of Postman and paste the compressed stream into the request. I gave up on Postman at that point. In short, it was the opposite to what you have. Working in SoapUI but not Postman!
- rvijayan0310New Contributor
Is there an latest update on this issue? Even I have started facing this issue since yesterday. Same API call works in Postman but not in ready API. Compared the request headers bwt postman & ready api and it is identical..Appreciate your help.
- ChrisAdamsChampion Level 3
Hi,
Sorry, I didn't contribute further.
usamant , did you resolve?
My last thoughts on this are still around seeing the response. I mean the whole Raw response and not just the headers. Both richie & I asked, but we only saw headers.
I have seen occasions where the service returns XML, so when you click on the JSON tab, you get the error usamant reported. I think this is valid. Postman might be super smart and transform from format x => y, or whatever. But if your service is returning 'text/html' or 'xml' or json', then in my humble opinion, that is what should be displayed in SoapUI.
Soapui is a testing tool for the API, someone in your organisation will still have to code to integrate with that API, and they're likely to have to consume the data in the returned format.
Related Content
- 5 years ago