500-Internal server error when calling external REST endpoint from workflow in OpenIDM 3.x

Last updated Jan 5, 2021

The purpose of this article is to provide assistance if your call to an external REST endpoint from a workflow in IDM/OpenIDM fails with a 500-Internal server error, where the associated Content-Type is 'application/x-www-form-urlencoded'.


This article has been archived and is no longer maintained by ForgeRock.


The REST call fails with the following error:

500-Internal server error

When the IDM/OpenIDM logging is set to FINEST, you can see that the action is invoked with the correct Content-Type; for example, your logs will show something similar to:

Oct 10, 2014 5:02:36 PM actionInstance FINE: Action invoked on call with { "content": { "authenticate": { "type": "basic", "user": "admin", "password": "Passw0rd" }, "headers": { "Content-Type": "application/x-www-form-urlencoded", "Accept": "application/json" }, "body": "grant_type=client_credentials", "method": "POST", "url": "" }, "additionalParameters": {  }, "action": "call", "method": "action", "resourceName": "", "fields": [  ] } Oct 10, 2014 5:02:36 PM setAttributes INFO: Adding header Content-Type: application/x-www-form-urlencoded

Later in the log where an attempt is made to execute the request, you can see that the Content-Type has changed to 'application/json': 

FINE: Attempt 1 to execute request Oct 10, 2014 5:02:36 PM org.apache.http.impl.conn.DefaultClientConnection sendRequestHeader FINE: Sending request: POST /openam/oauth2/access_token HTTP/1.1 Oct 10, 2014 5:02:36 PM org.apache.http.impl.conn.Wire wire FINE: >> "POST /openam/oauth2/access_token HTTP/1.1[\r][\n]" Oct 10, 2014 5:02:36 PM org.apache.http.impl.conn.Wire wire FINE: >> "Date: Fri, Oct 10, 2014 17:02:36 GMT[\r][\n]" Oct 10, 2014 5:02:36 PM org.apache.http.impl.conn.Wire wire FINE: >> "Content-Type: application/json; charset=UTF-8[\r][\n]"

Recent Changes



When IDM/OpenIDM makes an external REST call, messages are passed through a client proxy, which may alter the header containing the Content-Type and change it to 'application/json'. Since the Content-Type is no longer correct, the external REST call fails.


This issue can be resolved by changing the curl command to use the contentType parameter instead of setting the Content-Type via the headers parameter. For example, replace the following parameter in your curl command:

"headers": { "Content-Type": "application/x-www-form-urlencoded" } 


"contentType" : "application/x-www-form-urlencoded" }

See Also

Integrator's Guide › Managing Workflows Over the REST Interface

Related Training


Related Issue Tracker IDs


Copyright and Trademarks Copyright © 2021 ForgeRock, all rights reserved.