Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

improve error handling accessing remote csw #932

Open
pvgenuchten opened this issue Jun 8, 2024 · 2 comments
Open

improve error handling accessing remote csw #932

pvgenuchten opened this issue Jun 8, 2024 · 2 comments
Labels

Comments

@pvgenuchten
Copy link
Contributor

pvgenuchten commented Jun 8, 2024

with this code, a nullpointer exception is displayed (probably returned by the service)

from owslib.csw import CatalogueServiceWeb
csw = CatalogueServiceWeb('https://inspire-geoportal.ec.europa.eu/srv/eng/csw?request=GetCapabilities&service=CSW')
csw.getrecords2(constraints=[], maxrecords=10)

returns:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/.cache/pypoetry/virtualenvs/geodatacrawler-Tgwd7rCc-py3.10/lib/python3.10/site-packages/owslib/catalogue/csw2.py", line 385, in getrecords2
    self._invoke()
  File "/home/.cache/pypoetry/virtualenvs/geodatacrawler-Tgwd7rCc-py3.10/lib/python3.10/site-packages/owslib/catalogue/csw2.py", line 715, in _invoke
    raise ows.ExceptionReport(self._exml, self.owscommon.namespace)
owslib.ows.ExceptionReport: 'java.lang.RuntimeException: java.lang.NullPointerException'

i wonder if owslib could provide more details, such as the actual url sent to the server

@pvgenuchten
Copy link
Contributor Author

was debugging on owslib sources

the request send is

<csw:GetRecords xmlns:atom="http://www.w3.org/2005/Atom"
    xmlns:csw="http://www.opengis.net/cat/csw/2.0.2"
    xmlns:csw30="http://www.opengis.net/cat/csw/3.0" xmlns:dc="http://purl.org/dc/elements/1.1/"
    xmlns:dct="http://purl.org/dc/terms/" xmlns:dif="http://gcmd.gsfc.nasa.gov/Aboutus/xml/dif/"
    xmlns:draw="gov.usgs.cida.gdp.draw" xmlns:fes="http://www.opengis.net/fes/2.0"
    xmlns:fgdc="http://www.opengis.net/cat/csw/csdgm" xmlns:gco="http://www.isotc211.org/2005/gco"
    xmlns:gfc="http://www.isotc211.org/2005/gfc" xmlns:gm03="http://www.interlis.ch/INTERLIS2.3"
    xmlns:gmd="http://www.isotc211.org/2005/gmd" xmlns:gmi="http://www.isotc211.org/2005/gmi"
    xmlns:gml="http://www.opengis.net/gml" xmlns:gml311="http://www.opengis.net/gml"
    xmlns:gml32="http://www.opengis.net/gml/3.2" xmlns:gmx="http://www.isotc211.org/2005/gmx"
    xmlns:gts="http://www.isotc211.org/2005/gts" xmlns:ogc="http://www.opengis.net/ogc"
    xmlns:om="http://www.opengis.net/om/1.0" xmlns:om10="http://www.opengis.net/om/1.0"
    xmlns:om100="http://www.opengis.net/om/1.0" xmlns:om20="http://www.opengis.net/om/2.0"
    xmlns:ows="http://www.opengis.net/ows" xmlns:ows100="http://www.opengis.net/ows"
    xmlns:ows110="http://www.opengis.net/ows/1.1" xmlns:ows200="http://www.opengis.net/ows/2.0"
    xmlns:rim="urn:oasis:names:tc:ebxml-regrep:xsd:rim:3.0"
    xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
    xmlns:sa="http://www.opengis.net/sampling/1.0" xmlns:sml="http://www.opengis.net/sensorML/1.0.1"
    xmlns:sml101="http://www.opengis.net/sensorML/1.0.1" xmlns:sos="http://www.opengis.net/sos/1.0"
    xmlns:sos20="http://www.opengis.net/sos/2.0" xmlns:srv="http://www.isotc211.org/2005/srv"
    xmlns:swe="http://www.opengis.net/swe/1.0.1" xmlns:swe10="http://www.opengis.net/swe/1.0"
    xmlns:swe101="http://www.opengis.net/swe/1.0.1" xmlns:swe20="http://www.opengis.net/swe/2.0"
    xmlns:swes="http://www.opengis.net/swes/2.0" xmlns:tml="ttp://www.opengis.net/tml"
    xmlns:wfs="http://www.opengis.net/wfs" xmlns:wfs20="http://www.opengis.net/wfs/2.0"
    xmlns:wcs="http://www.opengis.net/wcs" xmlns:wms="http://www.opengis.net/wms"
    xmlns:wps="http://www.opengis.net/wps/1.0.0" xmlns:wps100="http://www.opengis.net/wps/1.0.0"
    xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xs="http://www.w3.org/2001/XMLSchema"
    xmlns:xs2="http://www.w3.org/XML/Schema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:wml2="http://www.opengis.net/waterml/2.0"
    outputSchema="http://www.opengis.net/cat/csw/2.0.2" outputFormat="application/xml"
    version="2.0.2" service="CSW" resultType="results" maxRecords="10"
    xsi:schemaLocation="http://www.opengis.net/cat/csw/2.0.2 http://schemas.opengis.net/csw/2.0.2/CSW-discovery.xsd">
    <csw:Query typeNames="csw:Record">
        <csw:ElementSetName>summary</csw:ElementSetName>
    </csw:Query>
</csw:GetRecords>

the response seems

<?xml version="1.0" encoding="UTF-8"?>
<response>
    <info>No 'request' parameter found</info>
</response>

seems this service expects a request parameter in request body?

Copy link

github-actions bot commented Oct 6, 2024

This Issue has been inactive for 90 days. In order to manage maintenance burden, it will be automatically closed in 7 days.

@github-actions github-actions bot added the stale label Oct 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant