Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion

Welcome to the CollectiveAccess support forum! Here the developers and community answer questions related to use of the software. Please include the following information in every new issue posted here:

  1. Version of the software that is used, along with browser and version

  2. If the issue pertains to Providence, Pawtucket or both

  3. What steps you’ve taken to try to resolve the issue

  4. Screenshots demonstrating the issue

  5. The relevant sections of your installation profile or configuration including the codes and settings defined for your local elements.

If your question pertains to data import or export, please also include:

  1. Data sample

  2. Your mapping

Answers may be delayed for posts that do not include sufficient information.

XML Exporter Error / OAI-PMH Provider Fail

edited March 2014 in Troubleshooting
I'm trying to set up the OAI-PMH provider using the documentation on
the wiki and running into some problems. I tried to make a Dublin Core
XML mapping and then put the code in the oai_provider.conf file, but
nothing was showing up on the OAI Repository Explorer.
Then I tried actually running an export with the mapping, and got the
error "Export failed: XML documents must have exactly one root
element." So I think the problem is in my export mapping, which is attached below. The documentation was helpful, but I still wasn't sure exactly how to format it, especially to pull in the creator from related entity record. Any advice would be appreciated!


  • edited March 2014
    Okay so first of all there were a number of issues with your mapping:

    - The context column doesn't exist anymore, this is now an option. It actually existed only for about a week. Have you by any chance downloaded an outdated template?
    - The options column must contain valid JSON, for example { "context" : "ca_entities", "restrictToRelationshipTypes" = [ "author" ] }
    - One of your source definitons was "ca_entites" which caused the export to quit with an error. The table is ca_entities.
    - Field names in the source column are very much case sensitive, i.e. the field for entity names is "displayname" not "displayName"
    - If you use namespaces you must define them or otherwise the underlying PHP component (DOMDocument) will complain
    - In XML exports you must wrap your field mappings for each record somehow. That was the "must only have 1 root" error. Otherwise you would just have a list of XML elements with no way to distinguish between records. So instead of

    <field1>My Document</field1>
    <field1>My Image</field1>

    You'd have

    <field1>My Document</field1>
    <field1>My Image</field1>

    I hope this makes sense!

    I've actually found an example DC OAI mapping I created a while back that pretty much uses all the features of the exporter - see the attachment. Complete with namespace definitions and all. I also tried plugging this mapping into a OAI provider and it works no problem. Feel free to use that as starting point!

    Let me know if you have any questions!

  • Thank you so much, Stefan! This was a big help, and the mapping was almost exactly what we needed with only minor changes.

    Now if I test export dc xml records they seem to work, but I'm still having difficulty setting up the OAI provider. In the oai_provider.conf file I plugged in the mapping code and changed "enabled = 0" to "enabled = 1." Then I tried to test on the OAI Repository explorer, but I'm getting 400 or 500 errors. Is there something else that needs to be done?

    Thanks again for your help!
  • Now we're getting this error:

    [Fri Mar 07 13:39:10 2014] [error] [client] PHP Fatal error:  Call to a member function getSetting()
    on a non-object in /collectiveaccess/app/public_html/admin/app/lib/ca/Service/OAIPMHService.php on line 753

    OAIPMHService.php line 753:

    if($this->exporter->getSetting('exporter_format') != "XML"){

                                                    $this->throwError(self::OAI_ERR_BAD_ARGUMENT, _t("Selected mapping %1 is invalid",$this->getMappingCode()));



                                    $this->table = $this->exporter->getAppDatamodel()->getTableName($this->exporter->get('table_num'));

    The exporter format is defined as XML in the mapping. I've seen similar error messages trying to use links to limited-access materials -- could this be an access issue?

    Thanks again for your help, and please let me know if there is more info I could provide.

  • So I take it the issue from your first post is sorted out?

    The error from your recent post looks like the exporter couldn't be loaded properly. That means either 1) the mapping code you set in oai_provider.conf is incorrect or 2) the 'default_format' setting for your provider in oai_provider.conf refers to a format that doesn't exist. It should be the same as the key of the format you defined (not the mapping code!), by default 'oai_dc'.

    This should definitely not result in a fatal error and we'll have to improve the error reporting in this portion of the code. When I set enabled to "1" in oai_provider.conf and plug in the mapping code in line 25, I can query the provider no problem (using the default format by omitting the metadataPrefix parameter), like so:

  • For some reason, this still isn't working. I'm attaching the exporter (almost identical to the one you posted, with just slight changes in the source column), and the conf file. I really can't see where the problem is, so I'm hoping you might have some insight.

    It's possible the problem is with the base URL. Our front end site is, and the back end is I tried both and (and tried them both without /dc) but no luck with either.

    Thanks so much for your help, if you have any advice!
  • edited March 2014
    Well, you forgot 2 commas in your oai_provider.conf. The first one after the mapping code, which meant the next line was part of that mapping code and the second one after the identifier namespace, which also shouldn't have a trailing slash. I attached a corrected version.

    I'm also working on better error reporting in the OAI provider right now.

    Your mapping looks okay, except that you might want to edit the options for the last mapping (ca_objects.rightText), which refer to attributes that might not even exist in your setup.
Sign In or Register to comment.