inveniosoftware / invenio-oaiserver

Invenio module that adds more fun to the platform.
https://invenio-oaiserver.readthedocs.io
MIT License
3 stars 44 forks source link

response is not correct for no records #186

Closed rerowep closed 1 year ago

rerowep commented 4 years ago

If we have no records the <ListRecords> opening tag is missing.

<?xml version=\'1.0\' encoding=\'UTF-8\'?>
<?xml-stylesheet type="text/xsl" href="/static/xsl/oai.xsl"?>
<OAI-PMH xmlns="http://www.openarchives.org/OAI/2.0/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.openarchives.org/OAI/2.0/ http://www.openarchives.org/OAI/2.0/OAI-PMH.xsd">
  <responseDate>2020-06-02T23:00:28Z</responseDate>
  <request until="2020-06-02T23:00:28+00:00Z" from_="2020-06-02T06:00:00+00:00Z" metadataPrefix="marc21" verb="ListRecords">
    https://localhost:5000/oai2d
  </request>

  <ListRecords/>
</OAI-PMH>
wgresshoff commented 4 years ago

<ListRecords/> is an opening and closing tag at the same time. But in my opinion, if the response of ListRecords is empty, the should be no <ListRecords> tag at all but <error code="noRecordsMatch"/> instead. But this is surely open for discussion, the spec is not so clear about it.

pronguen commented 4 years ago

If there are no records to be returned, the OAI provider should not send ListRecords response with empty contents, but noRecordsMatch error message. Please see "Error and Exception Conditions" section in: http://www.openarchives.org/OAI/openarchivesprotocol.html#ErrorConditions

We are using Ex-libris Primo, a java client very common and often used in libraries, and it does not understand an empty ListRecords tag. Python clients seem therefore to understand such a response.

jesusbagpuss commented 3 years ago

This issue has just been reported on the OAI-PMH Google group.

A zenodo repository was failing it's validation, as the set chosen to validate against (in their case, the openaire set) didn't contain any records, but output an empty <ListIdentifiers/> element rather than the expected <error code="noRecordsMatch"/>.

Currently they are unable to register their OAI-PMH endpoint.