Consuming Rest API: The underlying connection was closed:An unexpected error occurred
Application Type
Service Studio Version
11.9.1 (Build 33435)

I am trying to consume an extremely simple Rest, a call to a public endpoint:

Calling this endpoint from a browser or with Postman gives the expected response, no problems, no errors. The domain of the external called endpoint supports TLS 1.2, I have checked that.

Calling this endpoint from the Outsystems platform (11.9.1) however gives me an error as shown below, The underlying connection was closed: An unexpected error occurred on a send. More details below.

 This can be reproduced on the development platform in the Logic/Integrations/Rest/Consume Rest API  interface and simply using the endpoint URL mentioned above. See error message detail below.

I have read most posts about similar issues on this Forum, but those posts are mostly years old and/or the "resolution" does not apply. Hence this new post.

Any suggestions? I am pretty much hopeless at this point. Thanks Denis.

The underlying connection was closed: An unexpected error occurred on a send.

[1] The underlying connection was closed: An unexpected error occurred on a send.
at System.Net.HttpWebRequest.GetResponse()
at sssantecure.CcEpicProduction.ActionGetMetadata(HeContext heContext, ICcEpicProductionCallbacks _callbacks, String inParamAccept, Int32 inParamProxy, String inParamEHR, STInstanceStructure& outParamResponse)

[2] Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host.
at System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset, Int32 size)
at System.Net.FixedSizeReader.ReadPacket(Byte[] buffer, Int32 offset, Int32 count)
at System.Net.Security.SslState.StartReceiveBlob(Byte[] buffer, AsyncProtocolRequest asyncRequest)
   at System.Net.Security.SslState.CheckCompletionBeforeNextReceive(ProtocolToken message, AsyncProtocolRequest asyncRequest)


Hi Denis,

I tried to call the REST API for that entrypoint and it went well:

What I did in Service Studio was add a Rest Service for the entrypoint you mentioned, test it and choose the option Copy to Response Body before Finish (and of course then call the service from a timer or button on a screen to test):

I'm using Service Studio 11.10.0 but I doubt it is because of the Service Studio version that it is not working on your side.

May it be that you have called this web service so many times that they blocked calls from your OutSystems infrastructure IP (hence the error message)?


Dear João,

Thank you for your kind help. Unfortunately, I am doing exactly the same as you are doing and I am getting the error message as mentioned before. Even in the platform Rest set-up screen as you have shown above. Where you are showing the correct response, I am getting the error.

I don't think this API provider closes off an IP address for this public API, but I will certainly check again. Remains the platform version?? Could it be as I am using 11.9.1 build 33435??

Regards and thanks again for your rapid response.


Hi Denis,

I tried it out in my Personal Environment and I succeed it.

Can you try on your Personal Environment and see if it works? If it does, it is necessarily something to do with your infrastructure (firewall or VPN maybe?) and then I would advise you to contact your Network Manager.

Kind regards,

I am trying it in my personal environment. Same error.


That's strange.

I would suggest to turn on the Logging of the API on Service Center:

And then, after running it again, check the Logs for the call you made (the option Detail will be available if you call the API with the Logging Level Full):

There you will be able to see (and download) the whole HTTP Trace where you will be able to check all that goes and comes from the call and you might find what is causing the issue:

Kind regards,

Hi  João,

Thanks again for looking into this! I had looked at the logs as you said and I am seeing the same error as I described before, see below. As this is a trace from my app and not just the bare REST interface in the dev platform, in the trace you see a few additional paramaters (Proxy and EHR) in the header, but that does not make a difference, I can use the same headers with Postman and will get the expected result without errors. They will get ignored anyway. So still stuck. Denis.


Hi Denis,

This may happen because of a firewall blockage around your OutSystems infrastructure.

Make sure the connection (host, protocol, port) is allowed.



Hi Nordin,

I am using the Outsystems hosted infrastructure and I don’t think I can set my own firewall rules. I also believe Outsystems’ infrastructure allows REST calls to all outside servers that expose a REST service and allow that through their firewall. So this should not be the issue?

So I did check with the API provider if my IP address (actually Outsystems' IP address as I am using the hosted Personal environment) could be blacklisted, but this is definitely not the case. And again, the request works perfectly fine from Postman or any browser. I do know that the endpoint only support TLS 1.2. But I assume that is not the issue, as I am make successful requests to other endpoints that only support TLS 1.2.

Anybody any suggestions why my REST requests from the Outsystems Environment could continue to give the same error message? Thanks!

Hello Denis,

Have you solved this issue? We are currently facing the same issue when consuming an API, it often to get this error message in the runtime. I tried to upscale the timeout in API action didn't work.

No, it was never resolved!

Shame, we also encountered this issue frequently from the consuming REST API processes. Are you using on-premises server for the production? And by the way have you ever try to raise this issue to OS support?

Hey Denis, im trying to consume a REST API and im getting the same error, did you ever find out the solution to that error?

hello, i am trying to consume rest api for Firebase Mobile ( and i am getting exactly the same error.

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.