Question

I am making a POST call to a tomcat server running Struts2 using the retrofit library on an Android Galaxy S3 (/Nexus 7) device. The POST call fails. The tomcat log shows Socket timeout exception.

The same POST using the exact same headers done via curl does not have any issues. I verified that the data on the wire matches using charles proxy.

Any tips/ideas on debugging this issue.

The post call is as follows

@POST(Constants.URL_GET_ORDER_LIST_BASE)
   void getCardOrderList(@Body GetOrderListRequest getOrderListRequest, Callback<GetOrderListResponse> cbGetOrderListResponse);

Please let me know if I need to add more information to explain this better.

Was it helpful?

Solution

Adding Square's OKHTTP library into the libs folder fixed the issue.

OTHER TIPS

I was having SocketTimeoutExceptions too. Pay attention to always add the final slash to your POST call.

Example:

BAD

@POST("/customers")

GOOD

@POST("/customers/")

My mistake was just this :)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top