Cannot resolve POST connection refused error, while GET and DELETE work
We have a simple API interface that has GET, POST, DELETE verbs Tested through Postman, and with Local Server and have NO issues with any, using the external IP address of the endpoints On the published site, however, GET and DELETE are working as expected, and the same as the local server, BUT I get this error with POST for no reason that I can discern. 10:02:51APPERRORConnector: An error has occurred while handling the request. [User 'ee9add56-095f-4d60-a15a-866e5dd13207' with session id '7ae7e461-XXXX-XXXX-XXXX-XXXXXXXX1688' and roles 'Administrator'] 10:02:51APPERRORConnector: com.mendix.modules.microflowengine.MicroflowException: Error calling REST service 10:02:51APPINFOat Excel_Module.Mf_POST_JSON (CallRest : 'Call REST (POST)') 10:02:51APPINFOAdvanced stacktrace: 10:02:51APPINFOat com.mendix.integration.actions.microflow.RestCallAction.execute(RestCallAction.scala:79) 10:02:51APPINFOCaused by: com.mendix.systemwideinterfaces.MendixRuntimeException: java.security.PrivilegedActionException: org.apache.http.conn.HttpHostConnectException: Connect to [redacted] failed: Connection refused (Connection refused) I have redacted the actual IP address, but we are using HTTP and port 3001 – this is the only thing that I can think of as being an issue. However, it is working fine for GET and DELETE. Have also set ‘Use Proxy Server’ to false from the microflow.
Have you tried debugging while setting the log level of REST Consume to trace? Maybe this will help you in finding the problem.
In this case, we finally resolved by having access to the API-Server logs (it is our own api-server). The file we wanted to POST to did not have write permissions for the API-Server, although Postman was able to carry on with no error, Mendix was not, which is actually preferable behaviour in my view.
The error message could have been more useful, write permission was refused and not access to the API?