我將Jet.com與基於Java的應用程序集成在一起。我成功地上傳了Merchant Sku批量上傳文件,但在合作伙伴儀表板中出現錯誤「未找到文件」。Jet.Com批量上傳錯誤
的Java API代碼:
try {
String url = fileURL.get("url").toString().trim();
String gzipFile = filePath + ".gz";
FileInputStream fis = new FileInputStream(file);
FileOutputStream fos = new FileOutputStream(gzipFile);
GZIPOutputStream gzipOS = new GZIPOutputStream(fos);
byte[] buffer = new byte[1024];
int len;
while((len=fis.read(buffer)) != -1){
gzipOS.write(buffer, 0, len);
}
//close resources
gzipOS.close();
fos.close();
fis.close();
HttpPut request = new HttpPut(url);
request.addHeader("x-ms-blob-type", "blockblob");
FileEntity entity = new FileEntity(new File(gzipFile));
entity.setContentType(ContentType.APPLICATION_OCTET_STREAM.toString());
entity.setContentEncoding("gzip");
request.setEntity(entity);
HttpResponse res = httpClient.execute(request);
System.out.println(EntityUtils.toString(res.getEntity()));
return true;
}
在查看在Jet.com合作伙伴門戶網站上傳的文件,它提供了錯誤 「找不到文件」。我猜這個問題可能與HttpPut文件上傳代碼有關,但我不確定。
請不要dd請求緊急/儘快等你的問題,[閱讀更多](http://meta.stackoverflow.com/q/326569)。謝謝。 – halfer
jet.com發回的HTTP返回碼是什麼? –
返回代碼是200 OK,如果您檢查文件上傳到Jet.com服務器,但它發出文件未找到錯誤 – Jayesh