You could report a bug, but until someone figures out how to reproduce your error, it cannot be solved.
If you could write up the steps you have taken to get to the error, I could follow them and see if I get the error as well. This way we could narrow down what caused it. Regards On Fri, 2009-07-03 at 10:33 +0200, WangFeng wrote: > Hi, > thank your for your answer. What should i do, if my program doesn't > cause this error. I mean, should i install the fedora 3.2 again? Or > report it as a BUG. > regards > feng > > > Subject: RE: [Fedora-commons-users] Ingest Problem with Fedora 3.2 > SOAP API by Calling uploadFile > > From: [email protected] > > To: [email protected] > > CC: [email protected] > > Date: Fri, 3 Jul 2009 09:57:27 +0200 > > > > hi > > > > Here is the function that fails > > > > /** > > * Upload the given file to Fedora's upload interface via HTTP POST. > > * > > * @return the temporary id which can then be passed to API-M > > requests as a > > * URL. It will look like uploaded://123 > > */ > > public String uploadFile(File file) throws IOException { > > PostMethod post = null; > > try { > > // prepare! the post method > > post = new PostMethod(getUploadURL()); > > post.setDoAuthentication(true); > > post.getParams().setParameter("Connection", "Keep-Alive"); > > > > // chunked encoding is not required by the Fedora server, > > // but makes uploading very large files possible > > post.setContentChunked(true); > > > > // add the file part > > Part[] parts = {new FilePart("file", file)}; > > post.setRequestEntity(new MultipartRequestEntity(parts, post > > .getParams())); > > > > // execute and get the response > > int responseCode = getHttpClient().executeMethod(post); > > String body = null; > > try { > > body = post.getResponseBodyAsString(); > > } catch (Exception e) { > > L! OG.warn("Error reading response body", e); > > } > &g t; if (body == null) { > > body = "[empty response body]"; > > } > > body = body.trim(); > > if (responseCode != HttpStatus.SC_CREATED) { > > throw new IOException("Upload failed: " > > + HttpStatus.getStatusText(responseCode) + ": " > > + replaceNewlines(body, " ")); > > } else { > > return replaceNewlines(body, ""); > > } > > } finally { > > if (post != null) { > > post.releaseConnection(); > > } > > } > > } > > > > So, from the error we know that > > HttpStatus.getStatusText(responseCode) gives "Bad Request" > > and replaceNewlines(body, " ") gives "no data sent" > > > > > > It seems that the Fedora instance does not accept the upload request > for > >! some reason. > > > > > > > > On Wed, 2009-07-01 at 18:26 +0200, WangFeng wrote: > > > Hi, > > > thank you for the mail. I thought too, either by reading my file > or by > > > calling the uploadFile() of FedoraClient causes this Problem. > > > > > > > > > public ClientTest() throws Exception { > > > ? ?? // TODO Auto-generated constructor stub > > > ? ? String baseURL = "http://localhost:8080/fedora/"; > > > ? ? fc = new FedoraClient(baseURL, "fedoraAdmin", "fedoraAdmin"); > > > ? ? APIA = fc.getAPIA(); > > > ? ? System.out.println("APIA Created!"); > > > ? ? APIM = fc.getAPIM(); > > > ? ? System.out.println("APIM Created"); > > > } > > > > > > > This actually proves nothing. You can create the APIA/N objects even > for > > a invalid repository. > > > > I usually test by doing APIA.describeRepository(), as this changes > > noth! ing, should always work, and will fail if there is a > credentials or > > connection problem. > > > > > > > > > > > > > > > public String addnewDatestream() throws IOException { > > > ? ? String tempURI = fc.uploadFile(new File("getPDF.pdf")); > > > > > > ? ? String ID = APIM.addDatastream("demo:SmileyPens", // PID > > > ? ? "MYPDFDS", // Datastream ID > > > ? ? new String[] { "FengDS", "PDFDS" }, // Alt IDs > > > ? ? "My Datastream", // Label > > > ? ? true, // Versionable > > > ? ? "application/pdf", // MIME type > > > ? ? null, // Format URI > > > ? ? tempURI, // Datastream Location > > > ? ? "M", // Control! Group > > > ? ? "A", // State > > > ? ? null, // ChecksumType > > > ? ? null, // Checksum > > > ? ? "added by feng wang"); // Log message > > > > > > ? ? return ID; > > > } > > > > > > > > > > > > Exception in thread "main" java.io.IOExcept! ion: Upload failed: > Bad > > > Request: No data sent. > > > at fedora.client.FedoraClient.uploadFile(FedoraClient.java:195) > > > > > > The file is saved under the TestProject Directory of the Java > > > WorkSpace in Windows system(E:\Java Workspace\TestProject > \getPDF.pdf) > > > > > > ? > > > > > > It's just A Test for writing the API-A/M FedoraClient. so i added > the > > > file into the demo from Fedora Server. But i am sure,that i can > call > > > ingest() and addDatastream(),which i have tested. > > > By the Way i haven't set any Configuration for the Log4J of > > > FedoraClient. > > > > > > Regards > > > Feng > > > > > > > > > > > > > > > > > > > Subject: Re: [Fedora-commons-users] Ingest Problem with Fedora > 3.2 > > > SOAP API by Calling uploadFile > > > > From: [email protected] > >! > > To: [email protected] > > > > CC: fedora! -c [email protected] > > > > Date: Wed, 1 Jul 2009 12: 12:52 +0200 > > > > > > > > Hi > > > > > > > > Could you give us the code piece where you call the function? > The > > > > exception seems to indicate that there is a problem reading your > > > file. > > > > > > > > Regards > > > > > > > > On Tue, 2009-06-30 at 20:51 +0200, WangFeng wrote: > > > > > Hi everyone, > > > > > i am writing a client by using the fedora client jar with SOAP > > > API. > > > > > So i tested all the Method from API-M. It works well by > calling > > > the > > > > > Method like ingest or adddatastream. > > > > > But i can't still use the uploadFile from fedoraclient or the > > > > > Uploader.upload(java.io.File file). And still got the > Exception > > > with > > > > > "No! data send to the server". I can't understand, why this > Method > > > > > couldn't be used. I am sure all setting for the file or > > > > > fileinputstream are fein and right. I must use the file from > local > > > and > > > > > upload it to server at first. > > > > > Please help me to ! fix it!! > > > > > Thanks > > > > > Feng > > > > > > > > > > > > > > > > > > > > > > > > > java.io.IOException: Upload failed: Bad Request: No data sent. > > > > > ?at > fedora.client.FedoraClient.uploadFile(FedoraClient.java:195) > > > > > ?at fedora.client.Uploader.upload(Uploader.java:114) > > > > > ?at fedora.client.Uploader.upload(Uploader.java:97) > > > > > ?at FoXM! L.ClientTest.uploader(ClientTest.java:269) > > > > > > > > > > > > > > > > >! ; > > > > > > ________________________________________ > ______________________________ > > > > > 更多热辣资讯尽在新版MSN首页! 立刻访问! > > > > > > > > > > > > > > ______________________________________________________________________ > > > 立刻下载 MSN 保护盾,保障Messenger 安全稳定! 现在就下载! > > > > > ______________________________________________________________________ > 使用新一代 Windows Live Messenger 轻松交流和共享! 立刻下载! ------------------------------------------------------------------------------ _______________________________________________ Fedora-commons-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/fedora-commons-users
