OpenIDM 5.5 external/rest call throws No content to map due to end-of-input

This topic contains 3 replies, has 3 voices, and was last updated by  Javilete 1 year, 5 months ago.

  • Author
    Posts
  • #21457
     JavierKainos 
    Participant

    When using openidm.action(“external/rest”, “call”, params) inside a groovy script and also using the REST API as follows an error is thrown.

    curl http://localhost:9080/openidm/external/rest?_action=call -X POST \
    -H “Content-Type: application/json” \
    -H “X-OpenIDM-Username: USERNAME” \
    -H “X-OpenIDM-Password: PASSWORD” \
    –data ‘{ “url”: “http://192.168.35.6:8080/accounts/USER_ID/deregister”, “method”: “POST”,”headers”: { “Content-Type”: “application/json” }}’

    The call returns a 204 and we can verify that it is executed successfully but when handling the response by OpenIDM it throws the following exception:

    Apr 12, 2018 1:44:07 PM org.forgerock.openidm.servlet.internal.ServletConnectionFactory$3 lambda$handleRequestWithLogging$8
    WARNING: Resource exception: 500 Internal Server Error: “No content to map due to end-of-input
    at [Source: java.io.BufferedReader@3c3a70d9; line: 1, column: 0]”
    org.forgerock.json.resource.InternalServerErrorException: No content to map due to end-of-input
    at [Source: java.io.BufferedReader@3c3a70d9; line: 1, column: 0]
    at org.forgerock.openidm.external.rest.RestService$1.apply(RestService.java:369)
    at org.forgerock.openidm.external.rest.RestService$1.apply(RestService.java:331)
    at org.forgerock.util.promise.PromiseImpl.lambda$then$6(PromiseImpl.java:369)
    at org.forgerock.util.promise.PromiseImpl.handleCompletion(PromiseImpl.java:531)
    at org.forgerock.util.promise.PromiseImpl.setState(PromiseImpl.java:572)
    at org.forgerock.util.promise.PromiseImpl.tryHandleResult(PromiseImpl.java:258)
    at org.forgerock.util.promise.PromiseImpl.handleResult(PromiseImpl.java:208)
    at org.forgerock.util.promise.PromiseImpl.lambda$then$6(PromiseImpl.java:369)
    at org.forgerock.util.promise.PromiseImpl.handleCompletion(PromiseImpl.java:531)
    at org.forgerock.util.promise.PromiseImpl.setState(PromiseImpl.java:572)
    at org.forgerock.util.promise.PromiseImpl.tryHandleResult(PromiseImpl.java:258)
    at org.forgerock.util.promise.PromiseImpl.handleResult(PromiseImpl.java:208)
    at org.forgerock.util.promise.PromiseImpl.lambda$then$6(PromiseImpl.java:369)
    at org.forgerock.util.promise.PromiseImpl.handleCompletion(PromiseImpl.java:531)
    at org.forgerock.util.promise.PromiseImpl.setState(PromiseImpl.java:572)
    at org.forgerock.util.promise.PromiseImpl.tryHandleResult(PromiseImpl.java:258)
    at org.forgerock.util.promise.PromiseImpl.handleResult(PromiseImpl.java:208)
    at org.forgerock.http.apache.async.AsyncHttpClient$PromiseHttpAsyncResponseConsumer.responseCompleted(AsyncHttpClient.java:143)
    at org.apache.http.impl.nio.client.MainClientExec.responseCompleted(MainClientExec.java:383)
    at org.apache.http.impl.nio.client.DefaultClientExchangeHandlerImpl.responseCompleted(DefaultClientExchangeHandlerImpl.java:168)
    at org.apache.http.nio.protocol.HttpAsyncRequestExecutor.processResponse(HttpAsyncRequestExecutor.java:436)
    at org.apache.http.nio.protocol.HttpAsyncRequestExecutor.responseReceived(HttpAsyncRequestExecutor.java:309)
    at org.apache.http.impl.nio.DefaultNHttpClientConnection.consumeInput(DefaultNHttpClientConnection.java:255)
    at org.apache.http.impl.nio.client.InternalIODispatch.onInputReady(InternalIODispatch.java:81)
    at org.apache.http.impl.nio.client.InternalIODispatch.onInputReady(InternalIODispatch.java:39)
    at org.apache.http.impl.nio.reactor.AbstractIODispatch.inputReady(AbstractIODispatch.java:114)
    at org.apache.http.impl.nio.reactor.BaseIOReactor.readable(BaseIOReactor.java:162)
    at org.apache.http.impl.nio.reactor.AbstractIOReactor.processEvent(AbstractIOReactor.java:337)
    at org.apache.http.impl.nio.reactor.AbstractIOReactor.processEvents(AbstractIOReactor.java:315)
    at org.apache.http.impl.nio.reactor.AbstractIOReactor.execute(AbstractIOReactor.java:276)
    at org.apache.http.impl.nio.reactor.BaseIOReactor.execute(BaseIOReactor.java:104)
    at org.apache.http.impl.nio.reactor.AbstractMultiworkerIOReactor$Worker.run(AbstractMultiworkerIOReactor.java:588)
    at java.lang.Thread.run(Thread.java:748)
    Caused by: com.fasterxml.jackson.databind.JsonMappingException: No content to map due to end-of-input
    at [Source: java.io.BufferedReader@3c3a70d9; line: 1, column: 0]
    at com.fasterxml.jackson.databind.JsonMappingException.from(JsonMappingException.java:270)
    at com.fasterxml.jackson.databind.ObjectMapper._initForReading(ObjectMapper.java:3854)
    at com.fasterxml.jackson.databind.ObjectMapper._readMapAndClose(ObjectMapper.java:3799)
    at com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:2903)
    at org.forgerock.http.util.Json.parse(Json.java:253)
    at org.forgerock.http.util.Json.readJson(Json.java:211)
    at org.forgerock.http.protocol.Entity.getJson(Entity.java:230)
    at org.forgerock.openidm.external.rest.RestService$1.apply(RestService.java:349)
    … 32 more

    #21460
     patrick.hagen@kit.edu 
    Participant

    Your endpoint does not seem to return (valid) json. Try detectResultFormat=false.

    #21463
     JavierKainos 
    Participant

    Tried detectResultFormat: false but the error is still happening.

    The problem was in the external API. A POST request is sent to the endpoint and it returns 204(No content) but the client expects a response body as the HTTP method was a POST.

    #21523
     Javilete 
    Participant

    After further investigation, it seems that 204 No Content is not a valid response from a external service when using “external/rest” API. In the case of a DELETE 204 No Content is a valid response and it throws the same error. I guess it is the internal client used by OpenIDM to send HTTP requests

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.

©2019 ForgeRock - we provide an identity and access platform to secure every online relationship for the enterprise market, educational sector and even entire countries. Click to view our privacy policy and terms of use.

Log in with your credentials

Forgot your details?