I have tested with the methods (getAbsoluteFile() or length() )from io.file. No
errors by using the file Method in my test program
Regards
Feng
From: [email protected]
To: [email protected]; [email protected]
Subject: RE: [Fedora-commons-users] Ingest Problem with Fedora 3.2 SOAP API by
Calling uploadFile
Date: Wed, 1 Jul 2009 19:15:41 +0100
Message
What happens
if you use the full file path in the File constructor? Also, you could try
reading the file locally first (eg print out its size) just to confirm that it
can be read ok.
Regards
Steve
-----Original
Message-----
From: WangFeng [mailto:[email protected]]
Sent: 01 July 2009 17:27
To: [email protected];
fedora commons users
Subject: Re: [Fedora-commons-users] Ingest
Problem with Fedora 3.2 SOAP API by Calling uploadFile
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");
}
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.IOException: 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:
[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 安全稳定! 现在就下载!
_________________________________________________________________
约会说不清地方?来试试微软地图最新msn互动功能!
http://ditu.live.com/?form=TL&swm=1------------------------------------------------------------------------------
_______________________________________________
Fedora-commons-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/fedora-commons-users