Michael.Shrall | 2018-02-27 00:52:12 UTC | #1
I am calling a custom json webservice post which takes a JSON body input but the response when I call using Postman is not json format. In fact it is just a string value, content-type is text/plain.
Is there any way to handle this setting the successtemplate to take the value as is without trying to parse it?
Error:
"status": 500, "code": "internal.server.error", "message": "The server encountered an unexpected condition which prevented it from fulfilling the request.", "messageParams": {}, "contextId": "6478bea2-a917-4785-b2c5-c6d0691281a4", "details": [], "errors": [ { "status": 202, "code": "INTERNALSERVERERROR", "message": "REST call for action execute failed. Message:We were unable to process the response from the remote endpoint (avtex.workflowcloud.com) because it had a 'content-type' header of 'text/plain; charset=utf-8' instead of the required value of 'application/json'. [6478bea2-a917-4785-b2c5-c6d0691281a4] [6478bea2-a917-4785-b2c5-c6d0691281a4]", "messageParams": {}, "details": [], "errors": [] } ]
Michael.Shrall | 2018-02-27 01:08:03 UTC | #2
Example raw response: cadbb3a1-1a7b-40ef-a810-0270b660bf0f
anon28066628 | 2018-02-27 04:13:11 UTC | #3
Hi Michael, currently all Data Action responses must be valid JSON objects. You can proxy the request through a light middleware that wraps the response in a valid object.
Jason_Mathison | 2018-03-07 15:01:36 UTC | #4
The most basic problem is that a response of cadbb3a1-1a7b-40ef-a810-0270b660bf0f is not valid JSON. If the response was wrapped in quotes like "cadbb3a1-1a7b-40ef-a810-0270b660bf0f" it would be valid JSON. Wrapping the ID in quotes and having the web service return a content-type of application/JSON would allow you to hit this API with a Data Action.
You are not the first person to hit this type of issue, so I entered Jira issue BPIVR-1510 to add 'limited support' for APIs that return a plain/text ID. By 'limited support' it would only allow you to build an output template using the raw response from the endpoint, there would not be any support for creating translation map entries. This issue has not been prioritized yet.
Michael.Shrall | 2018-03-07 15:17:32 UTC | #5
Thanks for the update Jason. We have also reported the issue to the 3rd party as they are non-conformant. They agreed but don't know when they will fix it.
system | 2018-04-07 15:17:32 UTC | #6
This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.
This post was migrated from the old Developer Forum.
ref: 2540