我正在尝试通过eBayPictureServiceXMLCall将图像上传到EBay,但是我发现上传一批图像需要花费几个小时。这是我的代码:
private String[] uploadImages(String[] pathToAllProductImagesAsArray) throws InterruptedException, IOException {
ApiContext context = getAPIContext();
int timeoutInMilli = 25000;
context.setTimeout(timeoutInMilli);
context.setEpsServerUrl("https://api.ebay.com/ws/api.dll");
eBayPictureServiceXMLCall pictureService = new eBayPictureServiceXMLCall(context);
//UploadSiteHostedPicturesRequestType request = new UploadSiteHostedPicturesRequestType();
PictureInfo[] picInfoArray = new PictureInfo[pathToAllProductImagesAsArray.length];
String[] pictureURLStrArray = new String[pathToAllProductImagesAsArray.length];
for (int i = 0; i < pathToAllProductImagesAsArray.length && i < 12; i++) {
pictureURLStrArray[i] = pathToAllProductImagesAsArray[i];
picInfoArray[i] = new PictureInfo();
picInfoArray[i].setPictureFilePath(pathToAllProductImagesAsArray[i]);
}
try {
picURLs = pictureService.uploadPictures(PhotoDisplayCodeType.SUPER_SIZE, picInfoArray);
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
我在eBay上一次列出了100多种产品,每个产品都有几张高分辨率图片。首次运行程序时,需要花费5到15秒的时间上传少量高质量的图像。但是,在上传了几十种产品的图像后,一切突然变得(几乎)完全停滞了-上传单个产品的图像只花了永远的时间(最后一批5-7张图像花费了大约7个小时)。附带的问题是,我将超时设置为2500毫秒,但在此时间之后没有引发异常。
这是否是我的错误(即使我的互联网连接正常)?还是在eBay的尽头?怎样解决这个问题才能快速上传图片?
谢谢