Hi Rob,

> I am pretty new to this, but am just testing a SWORD service that has been 
> created for our ArchivalWare-based repository.

No problem, welcome to the list :)

I maintain the PHP SWORD library, so I'll try and help out...

> I have been trying to use the PHP library to create a simple client to 
> deposit files to the test library. I find that the packager 
> (PackagerMetsSwap) seems to work fine, and I can deposit these using curl 
> from the command line, but the SWORDAPPclient->deposit() function is broken.
>  
> The problem lies on line 98:
>  
> curl_setopt($sac_curl, CURLOPT_READDATA, fopen($sac_fname, 'rb'));
>  
> “CURLOPT_READDATA” appears to be part of libcurl, but not implemented in 
> (current versions?) of PHP (it’s not listed in the documentation for 
> curl_setopt - http://uk2.php.net/manual/en/function.curl-setopt.php ).

Unfortunately the PHP CURL documentation is quite bad, and missing a lot of 
information.  This has caused a lot of pain particularly with the SWORD v2 
version I have been writing where as well as simple GETs and POSTs, we've had 
to implement PUTs and DELETEs, along with multipart and binary data.

How have you tracked the issue down to that line?  Is it that line that throws 
an error, if so, what is the error?


> I have been trying to use CURLOPT_POSTFIELDS to upload, but am getting 
> repeated errors, including 415 (unsupported media type) return codes, and 
> “Type application/zip; boundary=----------------------------52629833d905 is 
> not accepted in collection 2ERROR<timestamp>”
>  
> CURLOPT_POSTFIELDS expects an associative array, with the filename so I’m 
> thinking that this might be part of the problem, or it might be an issue with 
> Content-Type (repository is expecting “application/zip”, and this is what I 
> have been stating on the command line, but I understand that curl posts 
> “multipart/form-data”).

SWORD v1 does not support any type of multipart deposit.  For a typical package 
deposit, where the package is a zip file, the Content-Type needs to be 
'application/zip'.


> Any advice would be welcome. The code I’ve been trying, with several 
> variations, is:
>  
>    $dep_url = "http://username:passw...@repository.ac.uk/path/to/library";;
>    $dep_file = $filename
>    $dep_on_behalf = $copyright-holder;
>    $dep_packaging = "http://www.loc.gov/METS/";;

What does ArchivalWare expect as the way your package is described?  DSpace, 
EPrints, and Fedora expect packages made using the PHP PackagerMetsSwap.php 
packager to be described using the header 'X-Packaging: 
http://purl.org/net/sword-types/METSDSpaceSIP'.

>    $dep_cont_type = "application/zip"; // I’ve tried “multipart/form-data” as 
> well

As above, you'll probably want 'application/zip' unless ArchivalWare expects 
differently?

What is the curl command you are using on the command line which works?

Thanks,


Stuart Lewis
Digital Development Manager
Te Tumu Herenga The University of Auckland Library
Auckland Mail Centre, Private Bag 92019, Auckland 1142, New Zealand
Ph: +64 (0)9 373 7599 x81928


------------------------------------------------------------------------------
5 Ways to Improve & Secure Unified Communications
Unified Communications promises greater efficiencies for business. UC can 
improve internal communications as well as offer faster, more efficient ways
to interact with customers and streamline customer service. Learn more!
http://www.accelacomm.com/jaw/sfnl/114/51426253/
_______________________________________________
sword-app-tech mailing list
sword-app-tech@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sword-app-tech

Reply via email to