Hi all,
I'm trying to work with the GeoNetwork API. I work with Geonetwork 3.0.4. I would like to insert into Geonetwork a new metadata.
I use the manpage of WGET (http://www.delafond.org/traducmanfr/man/man1/wget.1.html) and the Geonetwork Developper Manuel 2.10.4 (http://geonetwork-opensource.org/manuals/2.10.4/eng/developer/xml_services/metadata_xml_insert_update_delete.html).
I'm using 2 commands : one to create the cookie (with login.xml which contains the admin login/password), the other to insert the metadata (with metadata_to_push.xml file, which is attached) :
wget -v --keep-session-cookies --save-cookies cookies_gn.txt
--post-file=login.xml --header "Content-type:application/xml"
http://geonetwork-mshe.univ-fcomte.fr:8080/geonetwork/srv/en/xml.user/login
wget -v --load-cookies cookies_gn.txt
--post-file=metadata_to_push.xml --header
"Content-type:application/xml"
http://geonetwork-mshe.univ-fcomte.fr:8080/geonetwork/srv/eng/metadata.insert
At first sight, the command which creates cookie seems correct and generates the file cookies_gn.txt which contains :
# HTTP cookie file.
# Generated by Wget on 2016-04-20 09:38:47.
# Edit at your own risk.
geonetwork-mshe.univ-fcomte.fr:8080 FALSE / FALSE 0 sessionExpiry 1461137927178
geonetwork-mshe.univ-fcomte.fr:8080 FALSE / FALSE 0 serverTime 1461137927178
geonetwork-mshe.univ-fcomte.fr:8080 FALSE /geonetwork/ FALSE 0 JSESSIONID 5C78716C458C162448718CD6E46D6E64
The second command fails : there isn't a new metadata in Geonetwork and we can see in local_access_log a problem with the authentication :
172.20.81.175 - - [20/Apr/2016:09:53:43 +0200] "POST
/geonetwork/srv/eng/metadata.insert HTTP/1.1" 302 -
172.20.81.175 - - [20/Apr/2016:09:53:43 +0200] "GET
/geonetwork/login.jsp?node=srv HTTP/1.1" 302 -
172.20.81.175 - - [20/Apr/2016:09:53:43 +0200] "GET
/geonetwork/srv/eng/catalog.signin?node=srv HTTP/1.1" 200 1904
Maybe the cookie created by the first command is incorrect. Indeed, if we use a cookie recovered in the Firefox console, we haven't this problem but another :
172.20.81.175 - - [20/Apr/2016:10:38:02 +0200] "POST
/geonetwork/srv/eng/metadata.insert HTTP/1.1" 302 -
172.20.81.175 - - [20/Apr/2016:10:38:02 +0200] "GET
/geonetwork/srv/eng/service-not-allowed?referer=/geonetwork/srv/eng/metadata.insert
HTTP/1.1" 200 2339
But in this case, why it doesn't work ? Is it a wrong service or a wrong metadata file ?
Is anyone have any idea?
Thank you in advance,
--
/Sophie MOLLARD/
/Pôle Géomatique/
/MSHE C. N. Ledoux (USR 3124) <http://mshe.univ-fcomte.fr>/
/Université de Franche-Comté/
/Tél : 03.81.66.51.55/
(attachments)
metadata_to_push.xml (12.2 KB)