Hi Stuart

I've reviewed the sword spec you sent through. It seems that the spec 
RECOMMENDS a deposit receipt is returned but doesn't REQUIRE it. Even 
the status code is not mandatory (provided I'm reading the spec 
correctly. The spec goes on to say " The server MAY, though, return any 
response which it feels appropriate" so it seems DSpace is returning the 
bare minimum of what is recommended (I.e. a 201 Created).

Based on this information, I've gone ahead and changed my code to return 
the "raw" result if no response XML is returned, which will stop an 
exception being thrown by SimpleXmlElement when the XML response is empty.

E.g.

             try {
                 if ($sac_resp) {
                     // Get the deposit results
                     $sac_xml = @new SimpleXMLElement($sac_resp);
                     $sac_ns = $sac_xml->getNamespaces(true);

                     // Build the deposit response object
                     $sac_dresponse->buildhierarchy($sac_xml, $sac_ns);
                 }
             } catch (Exception $e) {
                 throw new Exception("Error parsing response entry (" . 
$e->getMessage() . ")");
             }

I've also made some minor modifications to the Sword PHP client so that 
it can be installed as a Joomla! library. Let me know if you would like 
me to send this through to you.

Cheers


Hayden

On 02/05/12 03:36, LEWIS Stuart wrote:
> Hi Hayden,
>
> Thanks for persisting with this - it's great to hear about the positive 
> outcome.  Unfortunately I've not got a working copy of DSpace / SWORD on my 
> PC since changing jobs.  If you're able to debug the PHP client's parsing of 
> the result, that would be great.  The spec doesn't specify the response 
> should be - it may be that no xml is returned, so the build hierarchy code 
> may not be needed.  I don't know what DSpace does in this respect.
>
> http://sword-app.svn.sourceforge.net/viewvc/sword-app/spec/tags/sword-2.0/SWORDProfile.html?revision=377#protocoloperations_addingcontent_mediaresource
>
> Thanks,
>
>
> Stuart
>
>
>
>

-- 
Hayden Young
Managing Director
Wijiti Pty Ltd
p. +61 (0) 08 6398 5010
e. haydenyo...@wijiti.com
w. www.wijiti.com
vcard. www.wijiti.com/vcard/haydenyoung.vcf

NOTICE
This e-mail and any attachments are intended for the addressee(s) only and may 
be confidential. They may contain legally privileged or copyright material. You 
should not read, copy, use or disclose them without authorization. If you are 
not the intended recipient please contact the sender as soon as possible by 
return e-mail and then please delete both messages. This notice should not be 
removed.


------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
sword-app-tech mailing list
sword-app-tech@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sword-app-tech

Reply via email to