.. _csw_services: CSW service =========== GeoNetwork opensource catalog publishes metadata using the OGC CSW (Catalog Services for the Web) protocol supporting HTTP binding to invoke the operations. The protocol operations are described in the document **OpenGISĀ® Catalogue Services Specification**: **http://portal.opengeospatial.org/files/?artifact_id=20555** GeoNetwork is compliant with the 2.0.2 version of the specification, supporting the following CSW operations: - :ref:`GetCapabilities` - :ref:`DescribeRecord` - :ref:`GetRecordById` - :ref:`GetRecords` - :ref:`Harvest` - :ref:`Transaction` This chapter briefly describes the different operations supported in GeoNetwork and gives some usage examples. To get a complete reference of the operations and parameters of each CSW operation refer to the document **OpenGISĀ® Catalogue Services Specification**. The invocation of the operations from a Java client is analogous as described in the chapter for XML services. CSW operations -------------- The CSW operations are divided in 2 types: Discovery and Publication. The Discovery operations are used to query the server about its capacities and to search and retrieve metadata from it. The Publication opertions (Harvest and Transaction) are used to insert metadata into the catalog. The CSW operations can be accesed using POST, GET methods and SOAP encoding. The GeoNetwork opensource catalog CSW Discovery service operations are accessible through the url: **http://localhost:8080/geonetwork/srv/en/csw** .. _GetCapabilities: GetCapabilities ``````````````` **GetCapabilities** operation allows CSW clients to retrieve service metadata from a server. The response to a **GetCapabilities** request is an XML document containing service metadata about the server. Request examples ^^^^^^^^^^^^^^^^ GET request:: http://localhost:8080/geonetwork/srv/en/csw?request=GetCapabilities&service=CSW&acceptVersions=2.0.2&acceptFormats=application%2Fxml POST request:: Url: http://localhost:8080/geonetwork/srv/en/csw Content-type: application/xml Post data: 2.0.2 application/xml SOAP request:: Url: http://localhost:8080/geonetwork/srv/en/csw Content-type: application/soap+xml Post data: 2.0.2 application/xml .. _DescribeRecord: DescribeRecord `````````````` **DescribeRecord** operation allows a client to discover elements of the information model supported by the target catalogue service. The operation allows some or all of the information model to be described. Request examples ^^^^^^^^^^^^^^^^ GET request:: http://localhost:8080/geonetwork/srv/en/csw?request=DescribeRecord&service=CSW&version=2.0.2&outputFormat=application%2Fxml&schemaLanguage=http%3A%2F%2Fwww.w3.org%2FXML%2FSchema&namespace=csw%3Ahttp%3A%2F%2Fwww.opengis.net%2Fcat%2Fcsw%2F2.0.2 POST request:: Url: http://localhost:8080/geonetwork/srv/en/csw Content-type: application/xml Post data: SOAP request:: Url: http://localhost:8080/geonetwork/srv/en/csw Content-type: application/soap+xml Post data: .. _GetRecordById: GetRecordById ````````````` **GetRecordById** request retrieves the default representation of catalogue metadata records using their identifier. To retrieve non public metadata a previous **xml.user.login** service invocation is required. See :ref:`login service `. Request examples ^^^^^^^^^^^^^^^^ GET request:: http://localhost:8080/geonetwork/srv/en/csw?request=GetRecordById&service=CSW&version=2.0.2&elementSetName=full&id=5df54bf0-3a7d-44bf-9abf-84d772da8df1 POST request:: Url: http://localhost:8080/geonetwork/srv/en/csw Content-type: application/xml Post data: 5df54bf0-3a7d-44bf-9abf-84d772da8df1 full SOAP request:: Url: http://localhost:8080/geonetwork/srv/en/csw Content-type: application/soap+xml Post data: 5df54bf0-3a7d-44bf-9abf-84d772da8df1 full .. _GetRecords: GetRecords `````````` GetRecords request allows to query the catalogue metadata records specifying a query in OCG Filter or CQL languages. To retrieve non public metadata a previous **xml.user.login** service invocation is required. See :ref:`login service `. Request examples ^^^^^^^^^^^^^^^^ GET request (using CQL language):: Url: http://localhost:8080/geonetwork/srv/en/csw?request=GetRecords&service=CSW&version=2.0.2&namespace=xmlns%28csw%3Dhttp%3A%2F%2Fwww.opengis.net%2Fcat%2Fcsw%2F2.0.2%29%2Cxmlns%28gmd%3Dhttp%3A%2F%2Fwww.isotc211.org%2F2005%2Fgmd%29&constraint=AnyText+like+%25africa%25&constraintLanguage=CQL_TEXT&constraint_language_version=1.1.0&typeNames=csw%3ARecord POST request:: Url: http://localhost:8080/geonetwork/srv/en/csw Content-type: application/xml Post data: AnyText %africa% SOAP request:: Url: http://localhost:8080/geonetwork/srv/en/csw Content-type: application/soap+xml Post data: AnyText %africa% The GeoNetwork opensource catalog CSW Publication service operations are accessible through the url: **http://localhost:8080/geonetwork/srv/en/csw-publication** .. _Harvest: Harvest ``````` The **Harvest** operation defines an interface for indirectly creating, modifying and deleting catalogue records by invoking a CSW client harvesting run from the server to a specified target. It can be run in either synchronous or asynchronous mode and the harvesting run can be executed just once or periodically. This operation requires user authentification to be invoked. Synchronous one-run Harvest example ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ POST request:: Url: http://localhost:8080/geonetwork/srv/en/csw-publication Content-type: application/xml Post data: http://[ URL to the target CSW server ]?request=GetCapabilities&service=CSW&version=2.0.2 http://www.isotc211.org/schemas/2005/gmd/ GET request:: Url: http://localhost:8080/geonetwork/srv/en/csw-publication?request=Harvest&service=CSW&version=2.0.2&Source=http://[ URL to the target CSW server ]&ResourceType=http://www.isotc211.org/schemas/2005/gmd/ Response:: 22 0 0 Aynchronous one-run Harvest example ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ POST request:: Url: http://localhost:8080/geonetwork/srv/en/csw-publication Content-type: application/xml Post data: http://[ URL to the target CSW server ]?request=GetCapabilities&service=CSW&version=2.0.2 http://www.isotc211.org/schemas/2005/gmd/ [ URI or email address of response handler ] GET request:: Url: http://localhost:8080/geonetwork/srv/en/csw-publication?request=Harvest&service=CSW&version=2.0.2&Source=http://[ URL to the target CSW server ]&ResourceType=http://www.isotc211.org/schemas/2005/gmd/&ResponseHandler=[ URI or email address of response handler ] Response:: http://[ URL to the target CSW server ]?request=GetCapabilities&service=CSW&version=2.0.2 http://www.isotc211.org/schemas/2005/gmd/ [ URI or email address of response handler ] e7684bec-1fa9-4053-814f-7ae970d7a4a1 .. _Transaction: Transaction ``````````` The **Transaction** operation defines an interface for creating, modifying and deleting catalogue records. This operation requires user authentification to be invoqued. Insert operation example ^^^^^^^^^^^^^^^^^^^^^^^^ POST request:: Url: http://localhost:8080/geonetwork/srv/en/csw-publication Content-type: application/xml Post data: ... Response:: 1 0 0 Update operation example ^^^^^^^^^^^^^^^^^^^^^^^^ POST request:: Url: http://localhost:8080/geonetwork/srv/en/csw Content-type: application/xml Post data: ... title Eurasia Response:: 0 1 0 Delete operation example ^^^^^^^^^^^^^^^^^^^^^^^^ POST request:: Url: http://localhost:8080/geonetwork/srv/en/csw Content-type: application/xml Post data: title africa Response:: 0 0 1 Errors ^^^^^^ - User is not authenticated:: Cannot process transaction: User not authenticated.