EPrints Technical Mailing List Archive
Message: #04651
< Previous (by date) | Next (by date) > | < Previous (in thread) | Next (in thread) > | Messages - Most Recent First | Threads - Most Recent First
[EP-tech] Re: Some questions about SWORDv2/CRUD endpoint
- To: <eprints-tech@ecs.soton.ac.uk>
- Subject: [EP-tech] Re: Some questions about SWORDv2/CRUD endpoint
- From: "Andy Reid" <Andy.Reid@lshtm.ac.uk>
- Date: Mon, 07 Sep 2015 14:18:16 +0100
Hi Richard, My sympathies: I spent about a month trying figure something like this out, and just about got it working before I went on holiday for two weeks... Now I'm back I'm struggling to recall the details. I was trying to push eprints XML and attached files into eprints via SWORD, and kept running up against similar problems. What I found was that AtomPub only seemed to support minimal metadata - title, creator, summary - but nothing else e.g. Journal. I can imagine that in your position as the Router, you don't want to have to be generating Eprints XML - presumably you want to be sending generic Atom, and not having to write native eprints XML? Most of the documentation I found around SWORD tended to be dSpace-centric, using DCTERMS for the extended metadata. I spent ages trying to adapt the EasyDeposit client , but could never get it to pass the XML to the right interpreter. In the end I started from scratch with PHP-CURL and solved it quite quickly. Not sure if this will help with your problem, Richard, but it might give some help to somebody. Here's a basic test rig that works for me (unless I've broken it while tidying it up for public consumption )... ============================================================================ <?php // create a new cURL resource $ch = curl_init(); $username='<EPRINTSUSERID>'; $password='*********'; curl_setopt($ch, CURLOPT_USERPWD, $username . ":" . $password); // service end-points // ::::::::::: WRONG::::::::::: This entry point, which you might assume is what you want, only gives you minimal AtomPub metadata in the resulting eprint object... // curl_setopt($ch, CURLOPT_URL, "http://researchonline.lshtm.ac.uk/sword-app/deposit/buffer"); // may relate to SWORD 1.3, not sure //RIGHT:::::::::::::::...Whereas this entry point plus the header below, passes the package to the eprint XML interpreter, and gives the full monty curl_setopt($ch, CURLOPT_URL, "http://researchonline.lshtm.ac.uk/id/contents"); curl_setopt($ch, CURLOPT_HEADER, 1); $pkgheader=Array('X-Packaging: http://eprints.org/ep2/data/2.0', 'Content-Type: text/xml', 'Metadata-Relevant: true', 'X-Verbose: true' , 'In-Progress: true'); curl_setopt($ch,CURLOPT_HTTPHEADER,$pkgheader); $DOCROOT= $_SERVER['DOCUMENT_ROOT']; $file_in = "$DOCROOT/publications/eprint5.xml"; // test file is eprints XML, including base64 document files $data=""> curl_setopt($ch, CURLOPT_POST,1); curl_setopt($ch, CURLOPT_POSTFIELDS, $data); curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE); ($result=curl_exec($ch) )|| die( "curl_exec failed: ". curl_error($ch)); //echo $result; $matches=array(); if(preg_match('/\/id\/eprint\/([0-9]*)/',$result,$matches)){ $ID=$matches[1]; print "\n\nID=$ID\n"; }else{ print "\n\nNo ID found in eprints response: Deposit failed"; } // close cURL resource, and free up system resources curl_close($ch); ?> =================================================================== I can't attach the test file as it is not really public domain, but I can send it to you privately if you want it. As I say, this might not be quite the problem you're trying to solve, but it was the only way I could get it working for a similar situation. It suited me because I already had the code to generate the EPXML. Welcome any insight from the Community. Andy Reid
Research Information Manager
Room G43, Executive Office
London School of Hygiene & Tropical Medicine
Keppel St
LONDON WC1E 7HT
+44 020-7927-2618
>>> Richard Jones <richard@cottagelabs.com> 29 August 2015 12:09 >>> Just a little more information ...
In this code can_produce actuall gets dataobj/eprint, which I think is correct, but I can't work out what %params contains. It ought to contain application/atom+xml; type=entry I'm finding it difficult to trace this through the code to find out where it is set and what it should contain. Cheers, Richard
|
- References:
- [EP-tech] Some questions about SWORDv2/CRUD endpoint
- From: Richard Jones <richard@cottagelabs.com>
- [EP-tech] Re: Some questions about SWORDv2/CRUD endpoint
- From: Richard Jones <richard@cottagelabs.com>
- [EP-tech] Re: Some questions about SWORDv2/CRUD endpoint
- From: Richard Jones <richard@cottagelabs.com>
- [EP-tech] Re: Some questions about SWORDv2/CRUD endpoint
- From: Richard Jones <richard@cottagelabs.com>
- [EP-tech] Some questions about SWORDv2/CRUD endpoint
- Prev by Date: [EP-tech] Re: Eprints-tech Digest, Vol 84, Issue 17
- Next by Date: [EP-tech] Default date values
- Previous by thread: [EP-tech] Re: Some questions about SWORDv2/CRUD endpoint
- Next by thread: [EP-tech] Re: Some questions about SWORDv2/CRUD endpoint
- Index(es):