Hi all,
first of all thanks to Jose Garcia for answering to "FW: App that generates
apps and metadata attached automatically".
Our goal now is only find a way to make: LOGIN REQUEST / CREATE NEW USER /
PUBLICATION OF THE METADATA:
Unfortunately we have problems:
*Scenario:*
**We're using OSGeo* (installed in april of this year) in a virtual machine.
Preinstalled Geonetwork version 3.0.3.0.
**Problem 1)**I'm using these APIs of version 2.10.4 because are the only
ones that I can find online:
http://geonetwork-opensource.org/manuals/2.10.4/eng/developer/xml_services/index.html
, in fact the new APIs I know are there:
http://localhost:8080/geonetwork/doc/api but when I try to access them in
the virtual machine (with geonetwork on) I get this error:
/Service not available
The service "/geonetwork/doc/api/" does not exist or you don't have
privileges to access it. Return to the search page./ :
I suppose this is caused by the fact I have lower version 3.0.3.0 and newer
APIs are available only for version 3.2 or higher (could be much better to
install that version to use newer beta APIs?)
**The port of GEONETWORK inside OSgeo is 8880* instead 8080, I don't know
why but it comes with that port in OsGeo.
**We are using POSTMAN* rest client to do POST / GET requests towards
geonetwork server that is on (We click "Start geonetwork" and then we try to
do requests using POSTMAN). We tried also with other rest clients different
from POSTMAN, but the problems are the same.
**In ADMIN CONSOLE / SETTINGS / CSW: CSW option is enabled* (and "inserted
metadata is public" option is enabled too)
*PROBLEM2):*
*ATTEMPTS TO MAKE REQUESTS:*
We tried to make LOGIN / CREATE USER / PUBLISHING METADATA requests but we
always get the same response, that seems OK but in reality doesn't work (I
will tell it below):
*ATTEMPT to make LOGIN REQUEST in POSTMAN: *
Method: POST
Url: http://localhost:8880/geonetwork/srv/en/xml.user.login
Headers: Key: Content-Type Value: application/xml
Body/raw:
<?xml version="1.0" encoding="UTF-8"?>
<request>
<username>admin</username>
<password>admin</password>
</request>
*ATTEMPT to make CREATE USER REQUEST in POSTMAN: *
Method: POST
Url: http://localhost:8880/geonetwork/srv/eng/xml.user.update
Headers: Key: Content-Type Value: application/xml
Body/raw:
<?xml version="1.0" encoding="UTF-8"?>
<request>
<id></id>
<operation>newuser</operation>
<username>chris</username>
<password>chris</password>
<password2>chris</password2>
<name>chris</name>
<surname>taglia</surname>
samantha@anonymised.com
<org></org>
<address></address>
<zip></zip>
<state></state>
<city></city>
<country></country>
<profile>Editor</profile>
<groups_Editor>221</groups_Editor>
<enabled>true</enabled>
</request>
*ATTEMPT to make CSW PUBLISH REQUEST in POSTMAN: *
Method: POST
Url: http://localhost:8880/geonetwork/srv/eng/csw-publication
Headers: Key: Content-Type Value: application/xml
*Body/raw:*
<?xml version="1.0" encoding="UTF-8"?>
<csw:Transaction xmlns:csw="http://www.opengis.net/cat/csw/2.0.2"
version="2.0.2" service="CSW">
<csw:Insert>
<simpledc xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:dct="http://purl.org/dc/terms/"
xmlns:geonet="http://www.fao.org/geonetwork">
<dc:title>Template for Dublin Core - Related resource 1</dc:title>
<dc:publisher />
<dc:creator />
<dc:subject />
<dc:subject />
<dc:description />
<dc:relation>http://…</dc:relation>
<dc:rights />
<dc:type />
<dc:format>text/plain</dc:format>
<dc:coverage>North 89, South -90, East 180, West -180.
Global</dc:coverage>
<dc:language>eng</dc:language>
<dct:created />
<dct:dateSubmitted />
<dct:references />
<dct:modified>2017-07-06T18:09:24</dct:modified>
<dc:identifier>ebeffe57-2f32-4220-a8ef-40e56cab79a0</dc:identifier>
</simpledc>
</csw:Insert>
</csw:Transaction>
*All these 3 requests returns a STATUS CODE 200 OK along with an HTML
instead of an XML response! 3 cookies are created correctly (JSESSIONID,
sessionTime, sessionExpiry). The user isn't created and the metadata isn't
published for real (I checked logging-in personally into geonetwork and
seeing it). The HTML response is ALWAYS this (for every request!):*
<!DOCTYPE html
SYSTEM "html">
<html ng-app="gn_login" lang="eng" id="ng-app">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>My GeoNetwork on OSGeo live - OSGeo</title>
<meta charset="utf-8">
<meta name="viewport" content="initial-scale=1.0, user-scalable=no">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="description" content="">
<meta name="keywords" content="">
<link rel="icon" sizes="16x16 32x32 48x48" type="image/png"
href="../../images/logos/favicon.png">
<link href="rss.search?sortBy=changeDate" rel="alternate"
type="application/rss+xml" title="My GeoNetwork on OSGeo live - OSGeo">
<link href="portal.opensearch" rel="search"
type="application/opensearchdescription+xml" title="My GeoNetwork on OSGeo
live - OSGeo">
<link href="/geonetwork/static/gn_login_default.css"
rel="stylesheet" media="screen">
<link href="/geonetwork/static/bootstrap-table.min.css"
rel="stylesheet" media="screen">
<link href="/geonetwork/static/ng-skos.css" rel="stylesheet"
media="screen">
<link href="/geonetwork/static/srv_custom_style.css"
rel="stylesheet" media="screen">
</head>
<body data-ng-controller="GnCatController">
<div class="navbar navbar-default gn-top-bar"
data-ng-hide="layout.hideTopToolBar"
data-ng-include="'../../catalog/templates/top-toolbar.html'"></div>
<div data-ng-include="'../../catalog/templates/signin.html'"></div>
<div ng-include="'../../catalog/templates/info.html'"></div>
<noscript>
<div class="alert" data-ng-hide="">
<strong></strong>
</div>
</noscript>
</body>
</html>
*Then I tried to inspect JAVASCRIPT code inside geonetwork (trying to see if
they were different the requests done by geonetwork itself) and I tried
again in POSTMAN with the following slightly modified requests:*
*ATTEMPT to make LOGIN REQUEST in POSTMAN: version2*
Method: POST
Url: http://localhost:8880/geonetwork/j_spring_security_check#
Headers: Key: Content-Type Value: application/xml
Body/form-data:
key: username value: admin
key: password value: admin
key: redirectUrl value: (empty)
*ATTEMPT to make CREATE USER REQUEST in POSTMAN: version2*
Method: GET
Url:
http://localhost:8880/geonetwork/srv/eng/admin.user.update?id=&operation=newuser&username=user666&password=user666&password2=user666&name=user666&surname=user666&email=user@anonymised.com&org=&address=&zip=&state=&city=&country=&profile=Editor&groups_Editor=221&enabled=true
Headers: Key: Content-Type Value: application/xml
*...but the same exact problem still persist! requests returns a STATUS CODE
200 OK along with an HTML instead of an XML response! And the HTML response
is EXACTLY the same I have put above
Even if I put wrong data in the authentication (username: whatever
password: whatever) it still returns 200 OK with the same HTML response.
IMPORTANT: when I try the CSWtestTool/cswPublication/cswTransactionInsert
inside geonetwork, putting the same xml metadata that I put in POSTMAN
cswPublish request, here it works and it publishes without problems! Strange
thing because in POSTMAN I make exactly the same request and it doesn't
work!*
*CURL:*
If i try to do the same with the following CURL commands I get a slightly
different response with respect to POSTMAN:
/curl -v -H 'Mime-type: application/xml'
http://localhost:8880/geonetwork/srv/en/xml.user.login?username=admin&password=admin/
OR
/curl -v -XPOST -H 'Mime-type: application/xml' -T
'/media/sf_SharedGis/__PROJECT/TransactionRequest.xml' -b 'JSESSIONID=here I
can put the JSESSION id after the login, but doesn t help'
http://localhost:8880/geonetwork/srv/eng/csw-publication/
*With all cURL commands I get always this response (for every request!):*
* Trying 127.0.0.1...
* Connected to localhost (127.0.0.1) port 8880 (#0)
POST /geonetwork/srv/eng/csw-publication HTTP/1.1
Host: localhost:8880
User-Agent: curl/7.47.0
Accept: */*
Cookie: JSESSIONID=o0uzdc6rzfezhet825yjg2wt
Mime-type: application/xml
Content-Length: 1053
Expect: 100-continue
< HTTP/1.1 302 Found
< Date: Thu, 21 Sep 2017 10:58:28 GMT
< Location: http://localhost:8880/geonetwork/login.jsp?node=srv
< Content-Length: 0
< Server: Jetty(8.1.16.v20140903)
* HTTP error before end of send, stop sending
<
* Closing connection 0
*How can I solve this (huge) PROBLEM 2? (remember I'm using Geonetwork
3.0.3.0 inside OSGeo, in a virtual machine).*
*PROBLEM 3)*
What's the difference between publishing with API:
http://geonetwork-opensource.org/manuals/2.10.4/eng/developer/xml_services/metadata_xml_insert_update_delete.html
AND publishing with the CSW service?
http://geonetwork-opensource.org/manuals/2.10.4/eng/developer/xml_services/csw_services.html
Thanks to anyone who wants to help. Sorry for the long email but I preferred
to include all the possible details.
Thank you very much for all the support.
--
Sent from: http://osgeo-org.1560.x6.nabble.com/GeoNetwork-users-f3860293.html