http.client request to local Lithium REST API timeout
I have problems using the http.client for calling the local REST API in an endpoint.
I need JSON data for REST calls as a response from an endpoint to further process it in the frontend.
With the rest context object it seems to not be possible to get an actual JSON object inside FreeMarker as the returned data from a rest() call is always a FreeMarker "node" object, e.g. XML, no matter if I specify "?restapi.response_format=json" in the URL or not.
So what I'm trying to do to circumvate this problem is using the http.client to get data from the local REST API but when I call something like:
<#local url = "http://community.lithium.com/restapi/vc/categories/?restapi.response_format=json" />
<#local requestObj = http.client.request(url) />
<#local responseObj = requestObj.get() />
I get back an error that says:
"error making http request: Request timed out"
The same thing works with another (remote/foreign) REST API without problems.
So my question is if I'm trying something that is just not possible, e.g. calling a (local) Lithium REST API via http.client?
The domain is listed under System > HTTP Client, I also tried to request data from other Lithium REST APIs like
http://community.sony.ch/restapi/vc/categories/?restapi.response_format=json
which also time out when called with the http.client but when entered directly in the browser these calls work as expected and return JSON data...this led to the suspicion that the http.client is just not able to interact with Lithium REST APIs, I hope I'm just doing something very simple wrong, quite new to Lithium^^...
I also thought it could be some kind of CORS issue and asked the Lithium support to adjust the CORS configuration, but didn't seem to help, the requests made from FreeMarker still time out when the target is a Lithium REST API.
any hints are very much appreciated!