[EP-tech] Re: SWORD Endpoint

Harry Newton hnewton at lincoln.ac.uk
Wed Oct 10 12:19:23 BST 2012


Ian,

I now have the depositing working as expected. Thanks very much for your help, it was greatly appreciated!

Thanks again,

Harry newton


On 9 Oct 2012, at 15:49, Ian Stuart <Ian.Stuart at ed.ac.uk> wrote:

> On 09/10/12 15:12, Harry Newton wrote:
>> Hi,
>> 
>> I have a question about depositing into ePrints via SWORD.
>> 
>> I have a php library to get the service document, then attempt to deposit a file. However, the service document always returns 401 unauthorised. This is even though I'm passing the username and password.
>> As for depositing, I am unsure of the url I should be depositing to. I understand it is my ePrints host, but what would the rest of the URL be? For example, the service document is <eprints>/sword-app/servicedocument. I just need to know how to deposit for a specific ePrint of a specific user.
> 
> You want some code something like:
> 
> my $username = "user1"; # to be defined
> my $password = "topSecret"; # to be defined
> my $host     = "my.server.example.com";
> my $endpoint = "sword-app/deposit";
> my $collection = "archive"; # could be "review" or "inbox"
> my $url = "http://" . $username . ":" . $password . "@"
>                     . $host . "/" . $endpoint . "/" . $collection;
> 
> my $archive = read_file("$dirname/$zipfile", binmode => ':raw' ) or 
> die('cant open input file');
>   my $ua = LWP::UserAgent->new();
>   my $req = HTTP::Request->new( POST => '' );
>   $req->header( 'X-Packaging' => 'known_format',
>                 'X-No-Op' => 'false',
>                 'X-Verbose' => 'false',
>                 'Content-Disposition' => "filename=$zipfile"
>   );
>   $req->content_type( 'application/zip' );
>   $req->content( $archive );
>   my $res = $ua->request($req);	
>   if ($res->is_success) {
>         print "$zipfile deposited.\n";
>         $count++;
>   }
>   else { print "$zipfile - ".$res->status_line, "\n"; }
> }
> 
> The challenge is knowing the string for "known_format" (and the 
> servicedocument will tell you what the server will accept), and making 
> the right metadata file in the .zip file.
> 
> -- 
> 
> Ian Stuart.
> Developer: ORI, RJ-Broker, and OpenDepot.org
> Bibliographics and Multimedia Service Delivery team,
> EDINA,
> The University of Edinburgh.
> 
> http://edina.ac.uk/
> 
> This email was sent via the University of Edinburgh.
> 
> The University of Edinburgh is a charitable body, registered in
> Scotland, with registration number SC005336.
> 
> *** Options: http://mailman.ecs.soton.ac.uk/mailman/listinfo/eprints-tech
> *** Archive: http://www.eprints.org/tech.php/
> *** EPrints community wiki: http://wiki.eprints.org/




More information about the Eprints-tech mailing list
http://mailman.ecs.soton.ac.uk/pipermail/eprints-tech/2012-October/001157.html
mailman.ecs.soton.ac.uk
crawl=CC-MAIN-2022-21
6325
application/http; msgtype=response
sha1:YCJHIADB2UWTJDKEG4MONB6XUSBUKL2B
<urn:uuid:da110ac5-620d-422f-834a-f8cc7e791d7f>
2022-05-26T08:24:45Z
152.78.68.130
text/html
sha1:3WVJNXPQYGBIDWBSXQOXNEJZQ3DANNVL
<urn:uuid:baa4ad0f-25ac-44ca-a1ae-af92c88eec1d>
http://mailman.ecs.soton.ac.uk/pipermail/eprints-tech/2012-October/001157.html
response
<urn:uuid:552eeaa7-a9b1-4630-8b6b-4ddc75f85e61>
isPartOf: CC-MAIN-2022-21
publisher: Common Crawl
description: Wide crawl of the web for May 2022
operator: Common Crawl Admin (info@commoncrawl.org)
hostname: ip-10-67-67-200
software: Apache Nutch 1.18 (modified, https://github.com/commoncrawl/nutch/)
robots: checked via crawler-commons 1.3-SNAPSHOT (https://github.com/crawler-commons/crawler-commons)
format: WARC File Format 1.1
conformsTo: https://iipc.github.io/warc-specifications/specifications/warc-format/warc-1.1/