Skip to main content
Published: March 12 2009, 10:12:00 PMUpdated: November 28 2020, 5:21:14 PM

I am getting java.net.SocketTimeoutException when using Java web service to make LMS FileTransferService SOAP calls, how to fix the issue?

Summary    

    Some Java SOAP engines like Axis2 or Apache CXF web service sets by default in Chunk mode, meaning it sends http data in chunk format. However;  eBay LMS API Web Service does not support 'Transfer-Encoding: chunked' http message-header and  returns an error. As a result, the client stub should be set in Non-Chunk mode with this line inside the upload and download method: testStub._getServiceClient().getOptions().setProperty(org.apache.axis2.transport.http.HTTPConstants.CHUNKED, Boolean.FALSE);

   If your ServiceClient class extends com.ebay.www.marketplace.services.FileTransferServiceStub.UploadFileResponseE the generated Stub class,  the ServiceClient.downloadFile implementation should be:

 public static boolean downloadFile(String fileSaveToPath, String task_ref_id, String file_ref_id) throws AxisFault, RemoteException, Exception {

     String authToken=LMSProperties.getInstance().getAuthToken();
     String endPointURL=LMSProperties.getInstance().getFtsEndPointURL();
     ServiceClient testStub = new ServiceClient(endPointURL);
     testStub._getServiceClient().getOptions().setProperty(Constants.Configuration.ENABLE_MTOM, Constants.VALUE_TRUE);
     testStub._getServiceClient().getOptions().setProperty(org.apache.axis2.transport.http.HTTPConstants.CHUNKED, Boolean.FALSE);
     testStub._getServiceClient().getOptions().setTimeOutInMilliSeconds(
     LMSProperties.getInstance().getTimeOutInMilliSeconds());
  …

}



How well did this answer your question?
Answers others found helpful