java - HTTP 500 code during JSON file upload -


i getting server error code 500 while trying upload json file server.the problem occurs because of parameters. when use plain json string, without multipart builder, works. code use below

many in advance

public void uploadsegmentcustomerlist(file jsonfile, string segmentid) throws ioexception {      if(this.apiclient.gettoken() == null){         apiclient.login();     }       multipartentitybuilder             builder = multipartentitybuilder.create();     builder.setmode(httpmultipartmode.browser_compatible);     httppost uploadpost = new httppost(restconfig.getbaseurl() + restconfig.getuploadurl().replace("@segmentid@",segmentid));     uploadpost.setheader("sessiontoken", this.apiclient.gettoken());      // attaches file post:      file f = jsonfile;     builder.addbinarybody("test" , new fileinputstream(f), contenttype.application_json,f.getname() );      httpentity multipart = builder.build();     uploadpost.setentity(multipart);      httpresponse response = apiclient.uploadpost(uploadpost);     int responsecode = response.getstatusline().getstatuscode();      log.info(string.valueof(response)+ " "+ responsecode); } 


Comments

Popular posts from this blog

asynchronous - C# WinSCP .NET assembly: How to upload multiple files asynchronously -

aws api gateway - SerializationException in posting new Records via Dynamodb Proxy Service in API -

asp.net - Problems sending emails from forum -