<html><head>

<meta name="Generator" content="Novell Groupwise Client (Version 14.0.1  Build: 117118)">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head>
<body style="font: 10pt/normal Segoe UI; margin: 16px 16px 4px; font-size-adjust: none; font-stretch: normal;"><div class="GroupWiseMessageBody" id="GroupWiseSection_1441625871000_Andy.Reid@lshtm.ac.uk_E7E91160180E0000BAA6000000100002_"><div>Hi Richard,</div><div>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.&nbsp; I was trying to push eprints XML and attached files&nbsp;into eprints via SWORD, and kept running up against similar problems.&nbsp; What I found was that AtomPub only seemed to support minimal metadata - title, creator, summary - but nothing else e.g. Journal.&nbsp; 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? &nbsp; Most of the documentation I found around SWORD tended to be dSpace-centric, using DCTERMS for the extended metadata.&nbsp; I spent ages trying to adapt the EasyDeposit client , but could never get it to pass the XML to the right interpreter.&nbsp; In the end I started from scratch with PHP-CURL and solved it quite quickly.</div><div><br></div><div>Not sure if this will help with your problem, Richard, but it might give some help to somebody.&nbsp; Here's a basic test rig that works for me (unless I've broken it while tidying it up for public consumption )...</div><div>============================================================================</div><div>&lt;?php<br>// create a new cURL resource</div><div><br>$ch = curl_init();<br>$username='&lt;EPRINTSUSERID&gt;';&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </div><div>$password='*********';&nbsp; </div><div><br>curl_setopt($ch, CURLOPT_USERPWD, $username . ":" . $password);</div><div><br></div><div>// service end-points</div><div>//&nbsp;&nbsp;::::::::::: WRONG::::::::::: This entry point,&nbsp;&nbsp;which you might assume is what you want,&nbsp;only gives you minimal AtomPub metadata in the resulting eprint object... </div><div>//&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; curl_setopt($ch, CURLOPT_URL, "<a href="http://researchonline.lshtm.ac.uk/sword-app/deposit/buffer">http://researchonline.lshtm.ac.uk/sword-app/deposit/buffer</a>");&nbsp;&nbsp;&nbsp;// may relate to SWORD 1.3, not sure</div><div><br></div><div>//RIGHT:::::::::::::::...Whereas this entry point plus the header below, passes the package to the eprint XML interpreter, and gives the full monty<br>curl_setopt($ch, CURLOPT_URL, "<a href="http://researchonline.lshtm.ac.uk/id/contents">http://researchonline.lshtm.ac.uk/id/contents</a>");</div><div><br></div><div><br>curl_setopt($ch, CURLOPT_HEADER, 1);</div><div><br></div><div>$pkgheader=Array('X-Packaging: <a href="http://eprints.org/ep2/data/2.0'">http://eprints.org/ep2/data/2.0'</a>,<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 'Content-Type: text/xml',<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 'Metadata-Relevant: true',<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 'X-Verbose: true' ,<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 'In-Progress: true');&nbsp;</div><div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br>curl_setopt($ch,CURLOPT_HTTPHEADER,$pkgheader);<br></div><div><br></div><div>$DOCROOT= $_SERVER['DOCUMENT_ROOT'];</div><div>$file_in = "$DOCROOT/publications/eprint5.xml";&nbsp;// test file is eprints XML, including base64 document files </div><div>$data=file_get_contents($file_in);<br><br>curl_setopt($ch, CURLOPT_POST,1);<br>curl_setopt($ch, CURLOPT_POSTFIELDS, $data);</div><div>curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);</div><div><br>($result=curl_exec($ch) )|| die( "curl_exec failed: ". curl_error($ch));</div><div><br>//echo&nbsp; $result;<br>$matches=array();<br>if(preg_match('/\/id\/eprint\/([0-9]*)/',$result,$matches)){<br>&nbsp;&nbsp;&nbsp; $ID=$matches[1];<br>&nbsp;&nbsp;&nbsp; print "\n\nID=$ID\n";<br>}else{</div><div>&nbsp;&nbsp;&nbsp;&nbsp;print "\n\nNo ID found in eprints response: Deposit failed";</div><div>}<br>// close cURL resource, and free up system resources<br>curl_close($ch);</div><div>?&gt;</div><div><br></div><div>===================================================================</div><div><br></div><div><br></div><div>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.</div><div><br></div><div>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.&nbsp; It suited me because I already had the code to generate the EPXML.&nbsp; </div><div><br></div><div>Welcome any insight from the Community.</div><div><br></div><div><br></div><span id="GWSignatureSent" style="padding-right: 0px; padding-left: 0px; margin-bottom: 5px; display: block;"><span style="display: block;"><br><span style="font-size: 10pt; display: inline-block; -ms-word-wrap: normal;"><div>Andy Reid</div>
<div>Research Information Manager</div>
<div>Room G43, Executive Office</div>
<div>London School of Hygiene &amp; Tropical Medicine</div>
<div>Keppel St</div>
<div>LONDON WC1E 7HT</div>
<div>+44 020-7927-2618</div>
<div><a href="http://orcid.org/0000-0002-2500-2980">http://orcid.org/0000-0002-2500-2980</a></div></span></span></span><span style="margin-bottom: 5px; display: block;"><br></span><div class="GroupWiseMessageBody" id="GroupWiseSection_1440846579000_richard@cottagelabs.com"><span class="GroupwiseReplyHeader">&gt;&gt;&gt; Richard Jones &lt;richard@cottagelabs.com&gt; 29 August 2015 12:09 &gt;&gt;&gt;<br></span><div>
<div dir="ltr">Just a little more information ...<div><div class="gmail_extra"><div class="gmail_quote"><div> </div><blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex; padding-left: 1ex; border-left-color: rgb(204, 204, 204); border-left-width: 1px; border-left-style: solid;"><div dir="ltr"><span><div></div><div>I've found an Atom.xsl stylesheet in EPrints/Plugins/Import/XSLT which seems to imply that there /is/ a default atom import plugin.  My sword deposit contains atom metadata, so this stylesheet should work nicely to create a new eprint with the relevant metadata.  The only thing is, it doesn't appear to get called during deposit.  In Eprints/Apache/CRUD.pm, there's this code (Line 762 in sub import_plugins):</div><div><br></div></span><div><span><div>my @plugins = $self-&gt;repository-&gt;get_plugins(</div><div>                type =&gt; "Import",</div><div>                can_produce =&gt; $self-&gt;accept_type,</div><div>                %params,</div><div>        );</div></span></div></div></blockquote><div><br></div><div>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.</div><div><br></div><div>Cheers,</div><div><br></div><div>Richard</div><div><br></div><div> </div><blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex; padding-left: 1ex; border-left-color: rgb(204, 204, 204); border-left-width: 1px; border-left-style: solid;"><div dir="ltr"><div><span><div><br></div><div>and it's being called with an accept_type of "application/atom+xml; type=entry".  My guess is that the Atom.xsl stylesheet is not being understood as the plugin which can handle this format.</div><div><br></div><div>I read through this documentation:</div><div><br></div><div><a href="http://wiki.eprints.org/w/Import_and_Export_Plug-ins" target="_blank">http://wiki.eprints.org/w/Import_and_Export_Plug-ins</a><br></div><div><br></div><div>And it appears to suggest that the XSLT plugins need a wrapper around them for the specific mimetype that they need to work with - is this right?  Or is there some way to get the XSLT import plugin to run as is?</div><div><br></div><div>If there's some other documentation that I've overlooked so far, any links much appreciated!</div><div><br></div></span><div>Cheers,</div><div><br></div><div>Richard</div><div><br></div><div class="gmail_extra"><br><div class="gmail_quote"><span>On 28 August 2015 at 09:50, Richard Jones <span dir="ltr">&lt;<a href="mailto:richard@cottagelabs.com" target="_blank">richard@cottagelabs.com</a>&gt;</span> wrote:<br></span><div><div class="h5"><blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex; padding-left: 1ex; border-left-color: rgb(204, 204, 204); border-left-width: 1px; border-left-style: solid;"><div dir="ltr"><span>Actually, I see an AtomMultipart.pm in the EPrints/Plugin directory, and it in turn tries to load a plugin which supports application/atom+xml, but I can't find a plugin that supports that particular format.  I think this is probably the same issue, then, as my (1) below - there doesn't appear to be a default atom plugin - is that right?<div><br></div><div>Cheers,</div><div><br></div><div>Richard</div><div><br></div></span><div class="gmail_extra"><br><div class="gmail_quote"><span>On 28 August 2015 at 09:32, Richard Jones <span dir="ltr">&lt;<a href="mailto:richard@cottagelabs.com" target="_blank">richard@cottagelabs.com</a>&gt;</span> wrote:<br></span><blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex; padding-left: 1ex; border-left-color: rgb(204, 204, 204); border-left-width: 1px; border-left-style: solid;"><div><div><div><div><div dir="ltr">Hi Folks,<div><br></div><div>We're currently working on a new version of the Jisc Publications Router, and am looking into how best to put the content into an EPrints via SWORDv2.  I'm encountering a few oddities, though, and I wonder if someone can clarify how that endpoint works for me?</div><div><br></div><div>1/ Posting an atom entry document to /id/content should result in the creation of a new eprint populated with the metadata from that document, but instead it creates an eprint with no metadata and the atom xml attached as a file called "main.bin".  Perhaps I'm missing some crosswalk configuration?</div><div><br></div><div><a href="http://swordapp.github.io/SWORDv2-Profile/SWORDProfile.html#protocoloperations_creatingresource_entry" target="_blank">http://swordapp.github.io/SWORDv2-Profile/SWORDProfile.html#protocoloperations_creatingresource_entry</a><br></div><div><br></div><div>2/ My service document says:</div><div><br></div><div>&lt;acceptPackaging&gt;<a href="http://purl.org/net/sword/package/Binary" target="_blank">http://purl.org/net/sword/package/Binary</a>&lt;/acceptPackaging&gt;<br></div><div><br></div><div>But when I PUT a file of this format tot he media resource I get a "package format not supported" error.</div><div><br></div><div>Also, it does not say that it supports SimpleZip, but if I PUT a SimpleZip it works fine.  Is there a place that I can customise the accept/acceptPackaging entries in the service document?</div><div><br></div><div>3/ Completing deposit doesn't appear to work.  When I POST to the eprint's Edit-IRI, I get a 405 Method Not Allowed, but it should update the eprint</div><div><br></div><div><a href="http://swordapp.github.io/SWORDv2-Profile/SWORDProfile.html#continueddeposit_complete" target="_blank">http://swordapp.github.io/SWORDv2-Profile/SWORDProfile.html#continueddeposit_complete</a><br></div><div><br></div><div><br></div><div>Looking at the code, with my limited Perl skills, it looks like the full SWORDv2 protocol is not supported - is there some documentation that will tell me what features are supported?  For example, does multipart deposit work? <a href="http://swordapp.github.io/SWORDv2-Profile/SWORDProfile.html#protocoloperations_creatingresource_multipart" target="_blank">http://swordapp.github.io/SWORDv2-Profile/SWORDProfile.html#protocoloperations_creatingresource_multipart</a></div><div><br></div><div>Any tips/pointers much appreciated.</div><div><br></div><div>Cheers,</div><div><br></div><div>Richard<br clear="all"><div><br></div>-- <br><div><div><br></div>Richard Jones, <div><br></div><div>Founder, Cottage Labs <div>t: @richard_d_jones, @cottagelabs</div><div>w: <a href="http://cottagelabs.com" target="_blank">http://cottagelabs.com</a><br><div><br></div></div></div></div>
</div></div>
</div></div><br></div></div><span>*** Options: <a href="http://mailman.ecs.soton.ac.uk/mailman/listinfo/eprints-tech" target="_blank" rel="noreferrer">http://mailman.ecs.soton.ac.uk/mailman/listinfo/eprints-tech</a><br>
*** Archive: <a href="http://www.eprints.org/tech.php/" target="_blank" rel="noreferrer">http://www.eprints.org/tech.php/</a><br>
*** EPrints community wiki: <a href="http://wiki.eprints.org/" target="_blank" rel="noreferrer">http://wiki.eprints.org/</a><br>
*** EPrints developers Forum: <a href="http://forum.eprints.org/" target="_blank" rel="noreferrer">http://forum.eprints.org/</a><br>
<br></span></blockquote></div><br><br clear="all"><span><div><br></div>-- <br><div><div><br></div>Richard Jones, <div><br></div><div>Founder, Cottage Labs <div>t: @richard_d_jones, @cottagelabs</div><div>w: <a href="http://cottagelabs.com" target="_blank">http://cottagelabs.com</a><br><div><br></div></div></div></div>
</span></div></div>
<br>*** Options: <a href="http://mailman.ecs.soton.ac.uk/mailman/listinfo/eprints-tech" target="_blank" rel="noreferrer">http://mailman.ecs.soton.ac.uk/mailman/listinfo/eprints-tech</a><br>
*** Archive: <a href="http://www.eprints.org/tech.php/" target="_blank" rel="noreferrer">http://www.eprints.org/tech.php/</a><br>
*** EPrints community wiki: <a href="http://wiki.eprints.org/" target="_blank" rel="noreferrer">http://wiki.eprints.org/</a><br>
*** EPrints developers Forum: <a href="http://forum.eprints.org/" target="_blank" rel="noreferrer">http://forum.eprints.org/</a><br>
<br></blockquote></div></div></div><div><div class="h5"><br><br clear="all"><div><br></div>-- <br><div><div><br></div>Richard Jones, <div><br></div><div>Founder, Cottage Labs <div>t: @richard_d_jones, @cottagelabs</div><div>w: <a href="http://cottagelabs.com" target="_blank">http://cottagelabs.com</a><br><div><br></div></div></div></div>
</div></div></div></div></div>
<br>*** Options: <a href="http://mailman.ecs.soton.ac.uk/mailman/listinfo/eprints-tech" target="_blank" rel="noreferrer">http://mailman.ecs.soton.ac.uk/mailman/listinfo/eprints-tech</a><br>
*** Archive: <a href="http://www.eprints.org/tech.php/" target="_blank" rel="noreferrer">http://www.eprints.org/tech.php/</a><br>
*** EPrints community wiki: <a href="http://wiki.eprints.org/" target="_blank" rel="noreferrer">http://wiki.eprints.org/</a><br>
*** EPrints developers Forum: <a href="http://forum.eprints.org/" target="_blank" rel="noreferrer">http://forum.eprints.org/</a><br>
<br></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature"><div><br></div>Richard Jones, <div><br></div><div>Founder, Cottage Labs <div>t: @richard_d_jones, @cottagelabs</div><div>w: <a href="http://cottagelabs.com" target="_blank">http://cottagelabs.com</a><br><div><br></div></div></div></div>
</div></div></div>
</div></div></div></body></html>