Jump to content

Request body not a json exception from REST DIspatcher in TIBCO


Ganesh Dhayarkar

Recommended Posts

Hi Team,

I am working on a project where, we are facing issue with REST dispatcher pallete. I am hitting the POST operation with one path parameter and one query parameter through REST client/SOAP UI. the Content type in Request header is 'application/json',I get Request body not a json format error. We do not have any requirement to passPOST data though. Please find below detail to analyze the issue. If I send '{}' as Post data the below POST method works. But as per our farmework and requrement its not good practice to send empty json format or any json data.

Let me know if anyone faced same issue before!!

Exception from REST Dispatcher pallete.:

 

 

 

 

Request Media Type[application/json] Error! Request Body is not JSON format.

 

HTTP/1.1 400 Bad Request

text/plain

 

 

 

 

HTTP Receiver input :

 

 

POST

/salesrequests/businessloans/859056a624cbdab233a43c5ad5bb0041ProcessId

HTTP/1.1

 

/salesrequests/businessloans/859056a624cbdab233a43c5ad5bb0041

ProcessId

POST /salesrequests/businessloans/859056a624cbdab233a43c5ad5bb0041ProcessId HTTP/1.1content-length: 0

host: localhost:48155

content-type: application/json

 

HTTP

48155

 

application/json

0

 

 

http://xmlns.tibco.com/bw/plugin-api/messages/context">

0:0:0:0:0:0:0:1

Link to comment
Share on other sites

  • 2 months later...

Hi I am having similar problem, for my case I am doing a DB insert and data got inserted while response of the rest call saying below Error:

{"ErrorMessage": "Request Media Type[application/json] Error or Server setting Error for Content-Type! Actually it is not JSON Data"}:

I wrote a client from tibco BW, converting my Post input to Json using Render JSON palette. for my case Http receiver input is #

 

 

PUT

/CriticalFlights

HTTP/1.1

{

"Request":{

"fltNbr":"107",

"depStn":"ORD",

"arrStn":"IAD",

"createBy":"74378"

}

}

 

/CriticalFlights

PUT /CriticalFlights HTTP/1.1content-type: application/json

connection: keep-alive

host: localhost:8085

param: application/json

content-length: 104

accept: application/json

user-agent: Java/1.7.0_09

accept-encoding: gzip

 

HTTP

8085

 

application/json

gzip

application/json

104

keep-alive

 

 

 

param

application/json

 

 

http://xmlns.tibco.com/bw/plugin-api/messages/context">

127.0.0.1

 

 

and REST Dispatch and Reply is throwing a response #

 

 

 

/BisinessProcess/Sub/AddCriticalFlights.process

 

 

{"ErrorMessage": "Request Media Type[application/json] Error or Server setting Error for Content-Type! Actually it is not JSON Data"}

 

HTTP/1.1 400 Bad Request

application/json

 

 

 

do anyone have any solution for this, I tried different things but not able to get a success response.

Thanks in advance.

Link to comment
Share on other sites

  • 2 years later...
I also have the same issue.The local code is working fine. However I found the Request Media errror in the server version.I have compared the process in the ear with the souce code. It's nearly same.Not quite sure why I get this error.Please kindly give me a advice if anyone knows how to fix this issue.
Link to comment
Share on other sites

  • 1 month later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...