I've never used the SWORD protocol, but it should be pretty easy to avoid the
mimetype exception (for the SWORD V2 interface).
I'm assuming that "atomserv+xml" and "atomsvc+xml" are used by different
services to identify the same SWORD/XML format. From some quick testing, it
seems like this is the case, but it may be an unsafe assumption.
To avoid the exception, simply paste the following in your console/script
somewhere after you require 'sword2ruby' and before you define your service:
Atom::HTTPResponse.module_eval { def validate_content_type(*); end }
Note: this could have unintended consequences for other aspects of your
application. It would be much better to monkeypatch the `initialize` method of
`Atom::Service` (defined in
https://github.com/swordapp/sword2ruby/blob/v1.0.1/lib/sword2ruby/service.rb),
but the developers haven't made it easy to do so (you would have to copy and
paste the contents of that method into your patch, modifying all instances of
"application/atomsvc+xml" to "application/atomserv+xml").
I've only tested this minimally, but was able to define a service successfully
on a local DSpace SWORDV2 installation.
Jacob Brown
-----Original Message-----
From: Bruno Zanette [mailto:[email protected]]
Sent: Tuesday, December 16, 2014 10:15 AM
To: [email protected]
Subject: [Dspace-tech] Help with Sword Client API (Ruby)
Hey everybody!
This is not a dspace specific question, but i hope someone can help me.
I'm implementing a Ruby sword client to submit itens to dspace using a custom
interface. I did some research and i found "sword2ruby"
library, but i'm trying to execute the example given on the project git page
(https://github.com/swordapp/sword2ruby) and it doesn't work.
The library is supposed to be compatible with sword 2.0 but when i configure it
to get swordv2/servicedocument it return an error on document mime-type:
------------
/home/bruno/.rvm/gems/ruby-2.1.4/gems/atom-tools-2.0.5/lib/atom/http.rb:492:in
`validate_content_type': unexpected response Content-Type:
"application/atomserv+xml". should be one of:
["application/atomsvc+xml"] (Atom::WrongMimetype)
------------
When i use sword 1.0 app, the script successfully validate servicedocument but
it crashes on post_media command. The logs say that there is no ingester for
the type of file:
------------
ERROR org.dspace.sword.CollectionDepositor @ Unacceptable content type
detected: text/plain for collection 1
2014-12-16 14:09:09,271 ERROR org.purl.sword.server.DepositServlet @
org.purl.sword.base.SWORDErrorException: Unacceptable content type in deposit
request: text/plain
------------
I've already tried to modify swordv2 configs to set generate options to use 1.3
version, but it didn't work.
I'm using dspace-4 (git version) on ubuntu 14.04.
Does anyone have some advice about it? Am I doing something wrong or the
library is broken?
Any thing is welcome!!!
Thanks!!
--
Bruno Nocera Zanette
+55 41 9992-2508
------------------------------------------------------------------------------
Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
from Actuate! Instantly Supercharge Your Business Reports and Dashboards
with Interactivity, Sharing, Native Excel Exports, App Integration & more
Get technology previously reserved for billion-dollar corporations, FREE
http://pubads.g.doubleclick.net/gampad/clk?id=164703151&iu=/4140/ostg.clktrk
_______________________________________________
DSpace-tech mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/dspace-tech
List Etiquette: https://wiki.duraspace.org/display/DSPACE/Mailing+List+Etiquette
------------------------------------------------------------------------------
Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
from Actuate! Instantly Supercharge Your Business Reports and Dashboards
with Interactivity, Sharing, Native Excel Exports, App Integration & more
Get technology previously reserved for billion-dollar corporations, FREE
http://pubads.g.doubleclick.net/gampad/clk?id=164703151&iu=/4140/ostg.clktrk
_______________________________________________
DSpace-tech mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/dspace-tech
List Etiquette: https://wiki.duraspace.org/display/DSPACE/Mailing+List+Etiquette