rbf_sendHttpRequest Unsupported media type error

Posted by dora.husaru on 23-Jul-2018 03:33

Hi,

I have been trying to make a call to a webservice from javascript in rollbase using rbf_sendHttpRequest but I keep on getting "Unsupported media type". I saw that the call from the browser for rbf_sendHttpRequest has "application/xml" but I want to get the response from a DataObject service which uses application/json.
Previously we did this calls using progress.data.Session, but we added user authentication and we also have to send the ClientPrincipal using CP_TOKEN.
We need to get some data that could have been changed by the user on the UI so we have to use some client side code.
Is there any way I can make the call with rbf_sendHttpRequest or is there another solution?

Best regards,

Dora

Posted by dora.husaru on 25-Jul-2018 02:12

Hi,

In the end I figured it out I was missing a header. I only used "Accept" as in this example: www.progress.com/.../client-side-rest-invocations-in-rollbase. But what I needed actually was also "Content-Type" :"application-json".

I added this header and  "X-OE-CLIENT-CONTEXT-ID" : "{!#CP_TOKEN}" for client principal info and now it seems to be working.

All Replies

Posted by Santosh Patel on 24-Jul-2018 11:53

Are you adding any headers like Content-Type? Please share the call sample that you are making

Posted by dora.husaru on 25-Jul-2018 02:12

Hi,

In the end I figured it out I was missing a header. I only used "Accept" as in this example: www.progress.com/.../client-side-rest-invocations-in-rollbase. But what I needed actually was also "Content-Type" :"application-json".

I added this header and  "X-OE-CLIENT-CONTEXT-ID" : "{!#CP_TOKEN}" for client principal info and now it seems to be working.

This thread is closed