This component is implemented as a web service that receives a remote request sent from landportal importers. The request is formed by a XML file, a dataset file and an API key. The internal architecture is implemented as a parser that extracts all the XML content and tree services (SQL, CKAN, RDF) that process that content and commit a transaction that involves an update in the three different databases.
Request example:
import requests
import codecs
# The landportal domain /receiver
url = '<http://landportal_uri/receiver>'
# The original dataset file from the source
dataset_file = open('<dataset_file>', 'rb')
# The generated XML file conforming to the schema described at Importers Doc
xml_file = codecs.open('<xml_file>', 'r', encoding="utf-8")
# The actual request including the api key obtained from CKAN registration
r = requests.post(url=url, data={'xml': xml_file.read(), 'api_key': '<your ckan_api key>'}, files={'file': dataset_file})
xml_file.close()
dataset_file.close()