Note that there are some explanatory texts on larger screens.

plurals
  1. PONo response of (ogc) "Sensor Observation Service" request from server
    text
    copied!<p>I am trying to make a "registerSensor" request. See the following xml file. But unfortunately i only get an exception, about an NULL GET request. What confuse me the most is the fact that i send and read by POST method.</p> <p>I know that probabely this issue doesn't fit to that forum, but i don't know where else to look for.... (would be even glad if you just give any advice, beside the ogc dokus)</p> <p>I tested it twice on my own server and also at: http: //giv-sos.uni-muenster.de: 8080/52nSOSv3/</p> <p>My request:</p> <pre><code> &lt;RegisterSensor service="SOS" version="1.0.0" xmlns="http://www.opengis.net/sos/1.0" xmlns:swe="http://www.opengis.net/swe/1.0.1" xmlns:ows="http://www.opengeospatial.net/ows" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:gml="http://www.opengis.net/gml" xmlns:ogc="http://www.opengis.net/ogc" xmlns:om="http://www.opengis.net/om/1.0" xmlns:sml="http://www.opengis.net/sensorML/1.0.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.opengis.net/sos/1.0" http://schemas.opengis.net/sos/1.0.0/sosRegisterSensor.xsd http://www.opengis.net/om/1.0 http://schemas.opengis.net/om/1.0.0/extensions/observationSpecialization_override.xsd&gt; &lt;SensorDescription&gt; &lt;sml:SensorML version="1.0.1"&gt; &lt;sml:member&gt; &lt;sml:System xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" &gt; &lt;sml:identification&gt; &lt;sml:IdentifierList&gt; &lt;sml:identifier&gt; &lt;sml:Term definition="urn:ogc:def:identifier:OGC:uniqueID"&gt; &lt;sml:value&gt;Test Sensor1&lt;/sml:value&gt; &lt;/sml:Term&gt; &lt;/sml:identifier&gt; &lt;/sml:IdentifierList&gt; &lt;/sml:identification&gt; &lt;sml:capabilities&gt; &lt;swe:SimpleDataRecord&gt; &lt;swe:field name="status"&gt; &lt;swe:Boolean&gt; &lt;swe:value&gt;true&lt;/swe:value&gt; &lt;/swe:Boolean&gt; &lt;/swe:field&gt; &lt;!-- status indicates, whether sensor is mobile (true) or fixed (false) --&gt; &lt;swe:field name="mobile"&gt; &lt;swe:Boolean&gt; &lt;swe:value&gt;true&lt;/swe:value&gt; &lt;/swe:Boolean&gt; &lt;/swe:field&gt; &lt;/swe:SimpleDataRecord&gt; &lt;/sml:capabilities&gt; &lt;sml:position name="sensorPosition"&gt; &lt;swe:Position referenceFrame="urn:ogc:def:crs:EPSG:4326"&gt; &lt;swe:location&gt; &lt;swe:Vector gml:id="STATION_LOCATION"&gt; &lt;swe:coordinate name="easting"&gt; &lt;swe:Quantity&gt; &lt;swe:uom code="degree"/&gt; &lt;swe:value&gt;12.99734&lt;/swe:value&gt; &lt;/swe:Quantity&gt; &lt;/swe:coordinate&gt; &lt;swe:coordinate name="northing"&gt; &lt;swe:Quantity&gt; &lt;swe:uom code="degree"/&gt; &lt;swe:value&gt;47.79367&lt;/swe:value&gt; &lt;/swe:Quantity&gt; &lt;/swe:coordinate&gt; &lt;swe:coordinate name="altitude"&gt; &lt;swe:Quantity&gt; &lt;swe:uom code="m"/&gt; &lt;swe:value&gt;433&lt;/swe:value&gt; &lt;/swe:Quantity&gt; &lt;/swe:coordinate&gt; &lt;/swe:Vector&gt; &lt;/swe:location&gt; &lt;/swe:Position&gt; &lt;/sml:position&gt; &lt;sml:inputs&gt; &lt;sml:InputList&gt; &lt;sml:input name="position"&gt; &lt;swe:ObservableProperty definition="urn:ogc:def:phenomenon:OGC:1.0.30:position"/&gt; &lt;/sml:input&gt; &lt;/sml:InputList&gt; &lt;/sml:inputs&gt; &lt;sml:outputs&gt; &lt;sml:OutputList&gt; &lt;sml:output name="position"&gt; &lt;swe:Quantity definition="urn:ogc:def:phenomenon:OGC:1.0.30:position"&gt; &lt;gml:metaDataProperty&gt; &lt;offering&gt; &lt;id&gt;position&lt;/id&gt; &lt;name&gt;Tracking Position Cartesian, in 2D&lt;/name&gt; &lt;/offering&gt; &lt;/gml:metaDataProperty&gt; &lt;swe:uom code="m"/&gt; &lt;/swe:Quantity&gt; &lt;/sml:output&gt; &lt;sml:output name="altitude"&gt; &lt;swe:Quantity definition="urn:ogc:def:property:OGC:AltitudeAboveMSL"&gt; &lt;gml:metaDataProperty&gt; &lt;offering&gt; &lt;id&gt;altitude&lt;/id&gt; &lt;name&gt;Altitude above Mean Sea Level&lt;/name&gt; &lt;/offering&gt; &lt;/gml:metaDataProperty&gt; &lt;swe:uom code="m"/&gt; &lt;/swe:Quantity&gt; &lt;/sml:output&gt; &lt;sml:output name="convell_a"&gt; &lt;swe:Quantity definition="urn:ogc:def:property:OGC:conva"&gt; &lt;gml:metaDataProperty&gt; &lt;offering&gt; &lt;id&gt;convell_a&lt;/id&gt; &lt;name&gt;Convidence Ellipse Semiaxis a&lt;/name&gt; &lt;/offering&gt; &lt;/gml:metaDataProperty&gt; &lt;swe:uom code="m"/&gt; &lt;/swe:Quantity&gt; &lt;/sml:output&gt; &lt;sml:output name="convell_b"&gt; &lt;swe:Quantity definition="urn:ogc:def:property:OGC:convb"&gt; &lt;gml:metaDataProperty&gt; &lt;offering&gt; &lt;id&gt;convell_b&lt;/id&gt; &lt;name&gt;Convidence Ellipse Semiaxis b&lt;/name&gt; &lt;/offering&gt; &lt;/gml:metaDataProperty&gt; &lt;swe:uom code="m"/&gt; &lt;/swe:Quantity&gt; &lt;/sml:output&gt; &lt;sml:output name="convell_phi"&gt; &lt;swe:Quantity definition="urn:ogc:def:property:OGC:convphi"&gt; &lt;gml:metaDataProperty&gt;&lt;offering&gt; &lt;id&gt;convell_phi&lt;/id&gt; &lt;name&gt;Convidence Ellipse Angle Phi&lt;/name&gt; &lt;/offering&gt; &lt;/gml:metaDataProperty&gt; &lt;swe:uom code="m"/&gt; &lt;/swe:Quantity&gt; &lt;/sml:output&gt; &lt;/sml:OutputList&gt; &lt;/sml:outputs&gt; &lt;sml:components&gt; &lt;sml:ComponentList&gt; &lt;sml:component name="sensorsystem"&gt;&lt;sml:Component&gt; &lt;sml:identification&gt; &lt;sml:IdentifierList&gt; &lt;sml:identifier&gt; &lt;sml:Term definition="urn:ogc:def:identifier:OGC:uniqueID"&gt; &lt;sml:value&gt;urn:ogc:object:feature:Sensor:TUWSystem&lt;/sml:value&gt; &lt;/sml:Term&gt; &lt;/sml:identifier&gt; &lt;/sml:IdentifierList&gt; &lt;/sml:identification&gt; &lt;sml:inputs&gt; &lt;sml:InputList&gt; &lt;sml:input name="position"&gt; &lt;swe:ObservableProperty definition="urn:ogc:def:phenomenon:OGC:1.0.30:position"/&gt; &lt;/sml:input&gt; &lt;/sml:InputList&gt; &lt;/sml:inputs&gt; &lt;sml:outputs&gt; &lt;sml:OutputList&gt; &lt;sml:output name="position"&gt; &lt;swe:Quantity definition="urn:ogc:def:phenomenon:OGC:1.0.30:position"&gt; &lt;gml:metaDataProperty&gt; &lt;offering&gt; &lt;id&gt;position&lt;/id&gt; &lt;name&gt;Tracking Position Cartesian, in 2D&lt;/name&gt; &lt;/offering&gt; &lt;/gml:metaDataProperty&gt; &lt;swe:uom code="m"/&gt; &lt;/swe:Quantity&gt; &lt;/sml:output&gt; &lt;sml:output name="altitude"&gt; &lt;swe:Quantity definition="urn:ogc:def:property:OGC:AltitudeAboveMSL"&gt; &lt;gml:metaDataProperty&gt; &lt;offering&gt; &lt;id&gt;altitude&lt;/id&gt; &lt;name&gt;Altitude above Mean Sea Level&lt;/name&gt; &lt;/offering&gt; &lt;/gml:metaDataProperty&gt; &lt;swe:uom code="m"/&gt; &lt;/swe:Quantity&gt; &lt;/sml:output&gt; &lt;sml:output name="convell_a"&gt; &lt;swe:Quantity definition="urn:ogc:def:property:OGC:conva"&gt; &lt;gml:metaDataProperty&gt; &lt;offering&gt; &lt;id&gt;convell_a&lt;/id&gt; &lt;name&gt;Convidence Ellipse Semiaxis a&lt;/name&gt; &lt;/offering&gt; &lt;/gml:metaDataProperty&gt; &lt;swe:uom code="m"/&gt; &lt;/swe:Quantity&gt; &lt;/sml:output&gt; &lt;sml:output name="convell_b"&gt; &lt;swe:Quantity definition="urn:ogc:def:property:OGC:convb"&gt; &lt;gml:metaDataProperty&gt; &lt;offering&gt; &lt;id&gt;convell_b&lt;/id&gt; &lt;name&gt;Convidence Ellipse Semiaxis b&lt;/name&gt; &lt;/offering&gt; &lt;/gml:metaDataProperty&gt; &lt;swe:uom code="m"/&gt; &lt;/swe:Quantity&gt; &lt;/sml:output&gt; &lt;sml:output name="convell_phi"&gt; &lt;swe:Quantity definition="urn:ogc:def:property:OGC:convphi"&gt; &lt;gml:metaDataProperty&gt; &lt;offering&gt; &lt;id&gt;convell_phi&lt;/id&gt; &lt;name&gt;Convidence Ellipse Angle Phi&lt;/name&gt; &lt;/offering&gt; &lt;/gml:metaDataProperty&gt; &lt;swe:uom code="m"/&gt; &lt;/swe:Quantity&gt; &lt;/sml:output&gt; &lt;/sml:OutputList&gt; &lt;/sml:outputs&gt; &lt;/sml:Component&gt; &lt;/sml:component&gt; &lt;/sml:ComponentList&gt; &lt;/sml:components&gt; &lt;/sml:System&gt; &lt;/sml:member&gt; &lt;/sml:SensorML&gt; &lt;/SensorDescription&gt; &lt;ObservationTemplate&gt; &lt;om:Measurement&gt; &lt;om:samplingTime/&gt; &lt;om:procedure/&gt; &lt;om:observedProperty/&gt; &lt;om:featureOfInterest&gt; &lt;/om:featureOfInterest&gt; &lt;om:result uom=""&gt; &lt;/om:result&gt; &lt;/om:Measurement&gt; &lt;/ObservationTemplate&gt; &lt;/RegisterSensor&gt; </code></pre> <p>The exception Response i get from the server:</p> <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;ows:ExceptionReport xmlns:ows="http://www.opengis.net/ows/1.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.0.0" xsi:schemaLocation="http://schemas.opengis.net/ows/1.1.0/owsExceptionReport.xsd"&gt; &lt;ows:Exception exceptionCode="InvalidRequest" locator="REQUEST"&gt; &lt;ows:ExceptionText&gt;The GET request null is not supported by this SOS. &lt;/ows:ExceptionText&gt; &lt;/ows:Exception&gt; &lt;/ows:ExceptionReport&gt; </code></pre> <p>The Java Code:</p> <pre><code>public class HttpRequest extends Thread { private String url = "http://giv-sos.uni-muenster.de:8080/52nSOSv3/sos"; private String charset = "UTF-8"; private String xml_request; //request to db in xml format private URLConnection connection; private OutputStream output; private InputStream input; private String query; //transformed xml request /** Ctor. * @param xml ogc request as String */ HttpRequest(String xml) { this.xml_request = xml; } //thread public void run() { // converting String xml to application/x-www-form-urlencoded MIME format try { query = URLEncoder.encode(xml_request, charset); //transforms special chars } catch (UnsupportedEncodingException e) { System.out.println(e.toString()); } System.out.println("REQUEST: "+xml_request.toString()); // create connection try { connection = new URL(url).openConnection(); System.out.println("CONNECTION: "+connection. toString()); connection.setDoOutput(true); //true = set method to POST connection.setDoInput(true); connection.setRequestProperty("Accept-Charset", charset); connection.setRequestProperty("Content-Type", "application/x-www-form-urlencoded; charset="+charset); } catch (MalformedURLException ex) { System.out.println("MalformedURLException: " + ex.toString()); } catch (IOException ex) { System.out.println("IOException: " + ex.toString()); } catch (Exception ex) { System.out.println("Exception: " + ex.toString()); } // open connection link try { connection.connect(); } catch (IOException ex) { System.out.println(ex.toString()); } try { //write outputstream to server output = connection.getOutputStream(); output.write(query.getBytes(charset)); //read response from server input = new URL(url).openStream(); Reader reader = new InputStreamReader(input); BufferedReader bufferedReader = new BufferedReader(reader); StringBuilder response = new StringBuilder(); String line = null; //read while((line = bufferedReader.readLine()) != null) response.append(line+"\n"); System.out.println("RESPONSE: "+response.toString()); //close reader bufferedReader.close(); // close stream } catch (IOException ex) { ex.printStackTrace(); } finally { if (output != null) try { output.close(); } catch (IOException ex) { System.out.println("IOEXCEPTION: "+ex.toString()); } } } } </code></pre> <p>The exceptionCode="InvalidRequest" is pretty obvious, but still confuse me that i can't find and clue of it in the doku....</p> <p>I am happy about every answer!</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload