我们是用AccessToken 免签名通讯协议上传某个产品到某个用户下面,现在碰到上传产品后,那个图片不知道怎么传。你们的接口里面是说通过 POST,可以也传不了。我下载了你们的SDK DEMO看了那个测试上传的,但那里面的代码只适用于个人开发者,不适用于ISV开发商,请问这个图片要怎么上传?
目前测试是通过POST请求的,参照SDK里面的那个新增产品代码,语句:参数语句:https://open.koudaitong.com/api/ ... %E5%95%86%E9%93%BA&
sku_outer_ids=&is_display=0&sku_properties=&post_fee=10.01×tamp=2016-09-18+16:36:48&is_virtual=0&title=%E6%B5%8B%E8%AF%95%E5%95%86%E5%93%81&price=999.01&
sku_quantities=&method=kdt.item.add&sku_prices=&access_token=9be209b737393bd98f8736b4636111f3
提交产品图片的语句:
if(null != filePaths && filePaths.size() > 0 && null != fileKey && !"".equals(fileKey)){
MultipartEntity mpEntity = new MultipartEntity(HttpMultipartMode.BROWSER_COMPATIBLE);
for(int i = 0; i < filePaths.size(); i++){
File file = new File(filePaths.get(i));
ContentBody cbFile = new FileBody(file);
mpEntity.addPart(fileKey, cbFile);
}
httppost.setEntity(mpEntity);
}
System.out.println("executing request " + httppost.getRequestLine());
HttpResponse response = client.execute(httppost);
在执行中,执行到HttpResponse response = client.execute(httppost);语句时,报:2016-09-18 16:59:56 -0 [main] INFO - I/O exception (java.net.SocketException) caught when processing request to {s}->https://open.koudaitong.com:443: Connection reset by peer: socket write error
2016-09-18 16:59:56 -7 [main] INFO - Retrying request to {s}->https://open.koudaitong.com:443
2016-09-18 16:59:57 -1080 [main] INFO - I/O exception (java.net.SocketException) caught when processing request to {s}->https://open.koudaitong.com:443: Connection reset by peer: socket write error
2016-09-18 16:59:57 -1152 [main] INFO - Retrying request to {s}->https://open.koudaitong.com:443
2016-09-18 16:59:58 -2150 [main] INFO - I/O exception (java.net.SocketException) caught when processing request to {s}->https://open.koudaitong.com:443: Connection reset by peer: socket write error
2016-09-18 16:59:58 -2150 [main] INFO - Retrying request to {s}->https://open.koudaitong.com:443
java.net.SocketException: Connection reset by peer: socket write error
上传单图可以成功,上传多图时失败,报上面的问题。
本帖最后由 5557c3a00042 于 2016-9-18 17:34 编辑
|