Home
Find the answer to your question
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()); … } |