ioos / pyoos

A Python library for collecting Met/Ocean observations
GNU Lesser General Public License v3.0
34 stars 33 forks source link

IoosSweSos/SensorObservationService_1_0_0 bug in __init__ #19

Closed DanRamage closed 10 years ago

DanRamage commented 10 years ago

The check of the self._capabilities for an exception can fail and allow a GetCapabilities response with an exception on through to the _build_metadata(), where an exception is thrown.

Sample code: dataCollector = IoosSweSos(url='http://ioossos.axiomalaska.com/52n-sos-ioos-stable/sos/kvp', xml=None) This will cause the failure, the suspect code sos code is: se = self._capabilities.find(nspath_eval('ows:ExceptionReport', namespaces))

The url generated for the getcapabilities is: http://ioossos.axiomalaska.com/52n-sos-ioos-stable/sos/kvp?service=SOS&request=GetCapabilities&version=1.0.0

The returned xml is:

<ows:ExceptionReport version="1.1.0" xsi:schemaLocation="http://www.opengis.net/ows/1.1 http://schemas.opengis.net/ows/1.1.0/owsAll.xsd"><ows:Exception exceptionCode="OptionNotSupported"><ows:ExceptionText>The optional parameter 'version' is not supported by this service!</ows:ExceptionText></ows:Exception></ows:ExceptionReport>
daf commented 10 years ago

Hi @DanRamage, can you elaborate a bit more where you see this issue occuring? I've been able to construct an IoosSweSos collector using that url. I'm assuming it's a transient problem with the server?

Also, your self.capabilities.find line and _build_metadata, I'm not sure where those lines are - they don't appear to be in the pyoos codebase.

DanRamage commented 10 years ago

Dave, Sorry about that, GitHub is eating the underscore characters. In the SensorObservationService_1_0_0 class, the init function is where the issue is occurring.

DanRamage commented 10 years ago

Further info: File sos100.py, line 56 I have:

se = self._capabilities.find(nspath_eval('ows:ExceptionReport', namespaces))
        if se is not None: 
            raise ows.ExceptionReport(se) 

This is the check that fails to catch the exception response from the XML I posted above.

daf commented 10 years ago

Ah, this is why I am so confused, those files are in OWSLib. I can still fix them, but this bug should really be filed against OWSLib instead of pyoos.

DanRamage commented 10 years ago

Ahhh, my bad. I wasn't paying attention, just stepping into the code to see what was going on!

daf commented 10 years ago

Not a problem, the layers are deep!