opensensorhub / osh-core

OpenSensorHub Core Modules
http://docs.opensensorhub.org
Mozilla Public License 2.0
32 stars 16 forks source link

GetResult request returns neither error nor data #81

Closed jamesyarrington closed 7 years ago

jamesyarrington commented 7 years ago

Running OSH locally. To Reproduce

  1. Insert a sensor with this POST:
    localhost:8181/sensorhub/sos
    <?xml version="1.0" encoding="UTF-8"?>
    <sos:InsertSensor service="SOS" version="2.0"
    xmlns:sos="http://www.opengis.net/sos/2.0"
    xmlns:sml="http://www.opengis.net/sensorML/2.0"
    xmlns:swes="http://www.opengis.net/swes/2.0"
    xmlns:swe="http://www.opengis.net/swe/2.0"
    xmlns:gml="http://www.opengis.net/gml/3.2">
    <procedureDescriptionFormat>http://www.opengis.net/sensorml/2.0</procedureDescriptionFormat>
    <swes:procedureDescription>
        <sml:PhysicalComponent>
            <identifier>urn:sensor001</identifier>
            <name>My New Sensor</name>
            <swe:validTime>
                              <gml:TimePeriod gml:id="T22">
                                      <gml:beginPosition>2017-06-27T20:35:15.760Z</gml:beginPosition>
                                      <gml:endPosition indeterminatePosition="now"/>
                              </gml:TimePeriod>
                        </swe:validTime>
        </sml:PhysicalComponent>
    </swes:procedureDescription>
    <swes:metadata>
        <sos:SosInsertionMetadata>
            <featureOfInterestType>http://www.opengis.net/def/observationType/OGCOM/2.0/OM_Measurement</featureOfInterestType>
            <observationType>http://www.opengis.net/def/samplingFeatureType/OGCOM/2.0/SF_SamplingPoint</observationType>
        </sos:SosInsertionMetadata>
    </swes:metadata>
    </sos:InsertSensor>
  2. Insert a result template for that sensor with this POST:
    localhost:8181/sensorhub/sos
    <?xml version="1.0" encoding="UTF-8"?>
    <sos:InsertResultTemplate service="SOS" version="2.0"
    xmlns:sos="http://www.opengis.net/sos/2.0"
    xmlns:sml="http://www.opengis.net/sensorML/2.0"
    xmlns:swes="http://www.opengis.net/swes/2.0"
    xmlns:swe="http://www.opengis.net/swe/2.0"
    xmlns:om="http://www.opengis.net/om/2.0"
    xmlns:xlink="http://www.w3.org/1999/xlink"
    xmlns:gml="http://www.opengis.net/gml/3.2">
    <sos:proposedTemplate>
        <sos:ResultTemplate>
            <sos:offering>urn:sensor001-sos</sos:offering>
            <om:resultStructure>
                <swe:DataRecord>
                    <swe:field name="phenomenonTime">
                        <swe:Time definition="http://www.opengis.net/def/property/OGC/0/PhenomenonTime">
                            <swe:label>Timestamp</swe:label>
                            <swe:uom xlink:href="http://www.opengis.net/def/uom/ISO-8601/0/Gregorian"/>
                        </swe:Time>
                    </swe:field>
                    <swe:field name="someName">
                        <swe:Quantity definition="urn:ogc:def:property:OGC::Velocity">
                            <swe:label>Some number I came up with</swe:label>
                        </swe:Quantity>
                    </swe:field>
                </swe:DataRecord>
            </om:resultStructure>
            <om:resultEncoding>
                <swe:TextEncoding tokenSeparator="," blockSeparator="@@"/>
            </om:resultEncoding>
        </sos:ResultTemplate>
    </sos:proposedTemplate>
    </sos:InsertResultTemplate>
  3. Insert a result with this POST:
    localhost:8181/sensorhub/sos
    <?xml version="1.0" encoding="UTF-8"?>
    <sos:InsertResult service="SOS" version="2.0"
    xmlns:sos="http://www.opengis.net/sos/2.0"
    xmlns:sml="http://www.opengis.net/sensorML/2.0"
    xmlns:swes="http://www.opengis.net/swes/2.0"
    xmlns:swe="http://www.opengis.net/swe/2.0"
    xmlns:om="http://www.opengis.net/om/2.0">
    <template>urn:sensor001#output0</template>
    <resultValues>2017-06-27T21:02:37.625Z,42.123</resultValues>
    </sos:InsertResult>
  4. Attempt to retrieve the inserted result with GetResult:
    localhost:8181/sensorhub/sos?service=SOS&version=2.0&request=GetResult&offering=2017-06-27T20:59:57.100Z-sos&observedProperty=urn:ogc:def:property:OGC::Velocity

Expected Result: The response should be the value 42.123, with no enclosing xml.

Actual Result: The response code is 200 OK, but the response body is empty.

Additional info: I am sure the result insertion was successful, because the GetObservation request works:

localhost:8181/sensorhub/sos?service=SOS&version=2.0&request=GetObservation&offering=2017-06-27T20:59:57.100Z-sos&observedProperty=urn:ogc:def:property:OGC::Velocity&temporalFilter=phenomenonTime,now

Returns the response (200 OK):

<?xml version='1.0' encoding='UTF-8'?>
<sos:GetObservationResponse xmlns:sos="http://www.opengis.net/sos/2.0" xmlns:om="http://www.opengis.net/om/2.0" xmlns:gml="http://www.opengis.net/gml/3.2" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:swe="http://www.opengis.net/swe/2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <sos:observationData>
        <om:OM_Observation gml:id="OBS_001">
            <om:type xlink:href="http://www.opengis.net/def/observationType/OGC-OM/2.0/SWEScalarObservation"/>
            <om:phenomenonTime>
                <gml:TimeInstant id="T1">
                    <gml:timePosition>2017-06-27T21:16:04.400Z</gml:timePosition>
                </gml:TimeInstant>
            </om:phenomenonTime>
            <om:resultTime>
                <gml:TimeInstant id="T2">
                    <gml:timePosition>2017-06-27T21:16:04.400Z</gml:timePosition>
                </gml:TimeInstant>
            </om:resultTime>
            <om:procedure xlink:href="2017-06-27T20:59:57.100Z"/>
            <om:observedProperty xlink:href="urn:ogc:def:property:OGC::Velocity"/>
            <om:featureOfInterest xlink:href="http://www.opengis.net/def/nil/OGC/0/unknown"/>
            <om:result xsi:type="swe:QuantityPropertyType">
                <swe:Quantity definition="urn:ogc:def:property:OGC::Velocity">
                    <swe:label>Some number I came up with</swe:label>
                    <swe:uom/>
                    <swe:value>42.123</swe:value>
                </swe:Quantity>
            </om:result>
        </om:OM_Observation>
    </sos:observationData>
</sos:GetObservationResponse>
alexrobin commented 7 years ago

The requests posted in this issue had several errors that I fixed directly in the original message. Even after fixing these, I cannot reproduce the problem in the last version, so I'm closing this for now.