REST API with SSL can't be consumed

REST API with SSL can't be consumed

  

Hello!

I have an issue trying to to consume All REST API Methods from another eSpace. I've get an error "WebException.SendFailure: The underlying connection was closed: An unexpected error occurred on a send." if SSL/TSL HTTP is set for Security parameter and no error if none is set. Esposing REST API Documentation parameter is Yes. SS version is 10.0.814.0. 


The same error I get if I try to use already created REST API consumer (I downloaded test framework application where two eSpaces connected via REST API). The call stack is following:

eSpaceVer: 2 (Id=2796, PubId=2848, CompiledWith=10.0.708.0)
RequestUrl: http://erp-dev.outsystems.fi/TestFramework/SuiteSetup.aspx?_ts=1525779594285 (Method: POST)
AppDomain: /LM/W3SVC/1/ROOT/TestFramework-763-131702506069430138
FilePath: E:\...\PS\running\TestFramework.884343439\SuiteSetup.aspx
ClientIp: 83.102.216.229 X-Forwarded-For: 83.102.216.229
Locale: en-US
DateFormat: dd-MM-yyyy
PID: 5204 ('w3wp', Started='4/12/2018 1:36:58 PM', Priv=2230Mb, Virt=19167Mb)
TID: 121
Thread Name: 
.NET: 4.0.30319.42000


[1] The underlying connection was closed: An unexpected error occurred on a send.
   at ssTestFramework_Probe_lib.CcPROBE.ActionGetUTFConsumers(HeContext heContext, ICcPROBECallbacks _callbacks, String inParamTargetESpace, RLGetUTFConsumersResponseList& outParamResponse)
   at ssTestFramework_Probe_lib.Actions.ActionGet_UTFConsumers(HeContext heContext, String inParamTargetESpace, String inParamEnvURL, RLGetUTFConsumersResponseList& outParamOut)
   at ssTestFramework_FindUnit_CS.RsseSpaceTestFramework_Probe_lib.MssGet_UTFConsumers(HeContext heContext, String inParamTargetESpace, String inParamEnvURL, RecordList& outParamOut)
   at ssTestFramework_FindUnit_CS.Actions.ActionScanUTF(HeContext heContext, Int32 inParamTestCaseId, String inParamTargetURL, String inParamInEnvURL, RLTestStepList& outParamTestSteps, String& outParamErrorMessage)

[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.ForceAuthentication(Boolean receiveFirst, Byte[] buffer, AsyncProtocolRequest asyncRequest)
   at System.Net.Security.SslState.ProcessAuthentication(LazyAsyncResult lazyResult)
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Net.TlsStream.ProcessAuthentication(LazyAsyncResult result)
   at System.Net.TlsStream.Write(Byte[] buffer, Int32 offset, Int32 size)
   at System.Net.ConnectStream.WriteHeaders(Boolean async)

[3] An existing connection was forcibly closed by the remote host
   at System.Net.Sockets.Socket.Receive(Byte[] buffer, Int32 offset, Int32 size, SocketFlags socketFlags)
   at System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset, Int32 size)


Any idea?

Best regards,
Valery

Did you get to test on your browser? Or in the server browser?

Formiga wrote:

Did you get to test on your browser? Or in the server browser?

HTTPS Request from browser works fine (https://serverAddress/TestFramework_Probe/rest/PROBE/GetUTFConsumers)



Did you find a solution?

Robinson Narvaez wrote:

Did you find a solution?


No, I have not try to fix it after facing with this issue. I postponed it for sometime.

Hi,

When consuming all methods of a REST API make sure that you provide the REST service URL, not the URL of a specific method.

Following the original poster's example:

https://serverAddress/TestFramework_Probe/rest/PROBE/GetUTFConsumers – this will not work, because you're including the "GetUTFConsumers" method in the URL and the Swagger specification for the REST API is located on the service root URL, not at the method level URL.

https://serverAddress/TestFramework_Probe/rest/PROBE/ – this will work, since you are providing the URL of the REST API itself, not the URL of a specific method.

It's easy to determine the correct URL if the REST API is being exposed by OutSystems: in Service Studio, right-click the REST API element in the element tree and click "Open Documentation". The documentation URL is also the URL of the Swagger specification.

Regards,
Pedro Sousa