[52N SWE] Sensor ML ......

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

[52N SWE] Sensor ML ......

Francesco D'Amore
Hi all...

I have a problem with the describe sensor request.....

When a Try to get information about a sensor with the SensorML
document attached to this mail, a get this response from the thin
client provided with 52North...

<ows:ExceptionReport version="1.0.0"
xsi:schemaLocation="http://schemas.opengis.net/ows/1.1.0/owsExceptionReport.xsd">
-
<ows:Exception exceptionCode="NoApplicableCode">
-
<ows:ExceptionText>
[EXC] internal service exception: org.xml.sax.SAXParseException
[EXC] message: Content is not allowed in prolog.
[EXC]com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(DOMParser.java:239)
[EXC]com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:283)
[EXC]org.n52.sos.ds.pgsql.PGSQLDescribeSensorDAO.getSensorDocument(PGSQLDescribeSensorDAO.java:241)
[EXC]org.n52.sos.DescribeSensorListener.receiveRequest(DescribeSensorListener.java:197)
[EXC]org.n52.sos.RequestOperator.doPostOperation(RequestOperator.java:268)
[EXC]org.n52.sos.SOS.doPost(SOS.java:340)
[EXC]javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
[EXC]javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
[EXC]org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
[EXC]org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
[EXC]org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
[EXC]org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
[EXC]org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
[EXC]org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
[EXC]org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
[EXC]org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)
[EXC]org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:845)
[EXC]org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
[EXC]org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
[EXC]java.lang.Thread.run(Thread.java:619)
</ows:ExceptionText>
</ows:Exception>
</ows:ExceptionReport>

I tried to debug the code for my self, through the source code
downloaded  from 52north....the code that parse the xml is
(PGSQLDescribeSensorDAO.java:241):


                    DocumentBuilderFactory factory =
DocumentBuilderFactory.newInstance();
                    DocumentBuilder builder = factory.newDocumentBuilder();
                    org.w3c.dom.Document doc = builder.parse(new
InputSource(new StringReader(smlFile)));

                    result = new SensorDocument(doc);

If a try to run this code, no exceptions are cached......it seems that
the xml is valid!!!

Any suggestions????

Thank you.....

--
Ing. Francesco D'Amore
blog: www.marinajonica.org
linkedin: http://www.linkedin.com/in/francescodamore
Consiglio Nazionale delle Ricerche - Istituto di Inquinamento Atmosferico (IIA)
Ph. D. Student at University of Calabria - DEIS

_______________________________________________
SWE mailing list
[hidden email]
http://www2.52north.org/mailman/listinfo/swe
http://sensorweb.forum.52north.org

iia-sea_sensor-1.xml (6K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: [52N SWE] Sensor ML ......

Daniel Nüst
Hello Francesco!

On 16.09.2010 18:21, Francesco D'Amore wrote:
> When a Try to get information about a sensor with the SensorML
> document attached to this mail, a get this response from the thin
> client provided with 52North...

First, you do not request information about a sensor using a SensorML
document, but the response (!) is a SensorML document.

You have to create a DescribeSensor request and send that to the SOS.
See the SOS Specification section 8.3.

> <ows:ExceptionReport version="1.0.0"
> xsi:schemaLocation="http://schemas.opengis.net/ows/1.1.0/owsExceptionReport.xsd">
> <ows:Exception exceptionCode="NoApplicableCode">
> <ows:ExceptionText>
> [EXC] internal service exception: org.xml.sax.SAXParseException
> [EXC] message: Content is not allowed in prolog.

This exception can occur when the document you send has any kind of
content (which you might not even be visible if you print it to the
console or sth.). Basically, before the root of you document, there
should be nothing (except the version and encoding declaration).

The link [1] below helped my a while back to figure out what was wrong
with my request, maybe it provides you a place to start looking what is
wrong.

> I tried to debug the code for my self, through the source code
> downloaded  from 52north....the code that parse the xml is
> (PGSQLDescribeSensorDAO.java:241):
>                     DocumentBuilderFactory factory =
> DocumentBuilderFactory.newInstance();
>                     DocumentBuilder builder = factory.newDocumentBuilder();
>                     org.w3c.dom.Document doc = builder.parse(new
> InputSource(new StringReader(smlFile)));
>
>                     result = new SensorDocument(doc);
>
> If a try to run this code, no exceptions are cached......it seems that
> the xml is valid!!!
> Any suggestions????

That source code parses the SensorML that is stored in the database. If
your request runs until then, then something is wrong with the sensor
description which is saved in your database. Or do you call the code
manually?

You should inspect what is stored in the description field of the sensor
that you request. Let us know if you figure out a solution!


Regards,
Daniel

[1]
http://mark.koli.ch/2009/02/resolving-orgxmlsaxsaxparseexception-content-is-not-allowed-in-prolog.html
_______________________________________________
SWE mailing list
[hidden email]
http://www2.52north.org/mailman/listinfo/swe
http://sensorweb.forum.52north.org
Reply | Threaded
Open this post in threaded view
|

Re: [52N SWE] Sensor ML ......

Francesco D'Amore
Hi Daniel....

I just fixed this bug in my database...due to a little bug in
SOSFeeder, provided by 52North.

When the SOS feeder insert the procedure in the database, it use this
sql statement (InsertProcedureDAO.java:150):

// insert statement for procedure table
insertStmt = "INSERT INTO " + DAOConstants.procTn + " VALUES ('" +
procedure_id + "','" + description_url + "','"
                        + description_type + "','" + sml_file +
"',GeometryFromText('" + geomWKT + "'," + EPSGid + "),"
                        + isActive + "," + isMobile + ");";


When I use this procedure, i set sml_file to null.....but it insert,
obviously for that sql, the string "null" in the database, and this
cause the error when i try to get a SensorML document as the services
doesn't reaches the file "null"!!!!!

I just fixed the bug in the SOSFeeder and in the table procedure and
every thing works fine. Thank you for your help and sorry for your
time reading my mail.



2010/9/17 Daniel Nüst <[hidden email]>:

> Hello Francesco!
>
> On 16.09.2010 18:21, Francesco D'Amore wrote:
>> When a Try to get information about a sensor with the SensorML
>> document attached to this mail, a get this response from the thin
>> client provided with 52North...
>
> First, you do not request information about a sensor using a SensorML
> document, but the response (!) is a SensorML document.
>
> You have to create a DescribeSensor request and send that to the SOS.
> See the SOS Specification section 8.3.
>
>> <ows:ExceptionReport version="1.0.0"
>> xsi:schemaLocation="http://schemas.opengis.net/ows/1.1.0/owsExceptionReport.xsd">
>> <ows:Exception exceptionCode="NoApplicableCode">
>> <ows:ExceptionText>
>> [EXC] internal service exception: org.xml.sax.SAXParseException
>> [EXC] message: Content is not allowed in prolog.
>
> This exception can occur when the document you send has any kind of
> content (which you might not even be visible if you print it to the
> console or sth.). Basically, before the root of you document, there
> should be nothing (except the version and encoding declaration).
>
> The link [1] below helped my a while back to figure out what was wrong
> with my request, maybe it provides you a place to start looking what is
> wrong.
>
>> I tried to debug the code for my self, through the source code
>> downloaded  from 52north....the code that parse the xml is
>> (PGSQLDescribeSensorDAO.java:241):
>>                     DocumentBuilderFactory factory =
>> DocumentBuilderFactory.newInstance();
>>                     DocumentBuilder builder = factory.newDocumentBuilder();
>>                     org.w3c.dom.Document doc = builder.parse(new
>> InputSource(new StringReader(smlFile)));
>>
>>                     result = new SensorDocument(doc);
>>
>> If a try to run this code, no exceptions are cached......it seems that
>> the xml is valid!!!
>> Any suggestions????
>
> That source code parses the SensorML that is stored in the database. If
> your request runs until then, then something is wrong with the sensor
> description which is saved in your database. Or do you call the code
> manually?
>
> You should inspect what is stored in the description field of the sensor
> that you request. Let us know if you figure out a solution!
>
>
> Regards,
> Daniel
>
> [1]
> http://mark.koli.ch/2009/02/resolving-orgxmlsaxsaxparseexception-content-is-not-allowed-in-prolog.html
> _______________________________________________
> SWE mailing list
> [hidden email]
> http://www2.52north.org/mailman/listinfo/swe
> http://sensorweb.forum.52north.org
>



--
Ing. Francesco D'Amore
blog: www.marinajonica.org
linkedin: http://www.linkedin.com/in/francescodamore
Consiglio Nazionale delle Ricerche - Istituto di Inquinamento Atmosferico (IIA)
Ph. D. Student at University of Calabria - DEIS
_______________________________________________
SWE mailing list
[hidden email]
http://www2.52north.org/mailman/listinfo/swe
http://sensorweb.forum.52north.org