Time Out Error when using OData Connection Service

Hello. I have a question about OData Connection by POST method. I am using Purchase Order API which is offered by SAP and  trying to create objects by using OData service. The Mendix application is deplyed on SAP cloud platform. This app connects to S4 HANA (on premise) through Cloud Connector. Successfully, I can get list of Purchase Order.(GET mothod) However, When I tried creating new Purchase Order, An error occured.(POST method) java.net.SocketTimeoutException Read timed out com.mendix.systemwideinterfaces.MendixRuntimeException: java.net.SocketTimeoutException: Read timed out at com.mendix.basis.actionmanagement.ActionManagerBase.executeSync(ActionManagerBase.java:156)... Actually, I found that I created new Purchase Order, but Socket timeout error message is displayed on a screen. ※I checked error log on SAP GUI, but SAP didn't throw any errors. Is this issue caused by Mendix? Can I extend timeout period? any help would be appreciated!
2 answers

Did you see this documentation: https://docs.mendix.com/partners/sap/sap-odata-connector#3-1-5-execute-entry ?

It is this part:

4.1.8 Request parameters

These are parameters which are used within the OData Connector for SAP solutions action to override the default behavior of the action. This should be passed as an object of entity type RequestParams.

The parameters which can be changed are:

  • Expected HTTP result - this is used to set the expected success code where this diverges from the specification. For example, the expected result from Create is 201 “created” but a service may have been configured to return 200 “OK”
  • Connection Timeout - how long the action should wait before assuming that the connection has timed out (default 60 seconds)
  • Read Timeout - how long the action should wait for a response to a request (default 120 seconds)
  • Proxy - override the default proxy settings for this action






Your Java socket is timing out means that it takes too long to get respond from other device and your request expires before getting response. This exception is occurring on following condition.

  •     Server is slow and default timeout is less, so just put timeout value according to you.
  •     Server is working fine but timeout value is for less time. so change the timeout value.


Solution: A developer can pre-set the timeout option for both client and server operations.

From Client side:

Socket socket = new Socket();
SocketAddress socketAddress = new InetSocketAddress(host, port);
socket.connect(socketAddress, 12000); //12000 are milli seconds

From Server side:

ServerSocket serverSocket = new new ServerSocket(port);