AaltoAsia / O-MI

Internet of Things data server implementing Open Messaging Interface and Open Data Format
BSD 4-Clause "Original" or "Old" License
22 stars 13 forks source link

Malformed odf received from agent - External Agent usage #4

Closed promania closed 8 years ago

promania commented 8 years ago

Hello! I have tried to deploy an external agent according to the python example (https://goo.gl/UZfTkE). However, I receive the following message: 14:04:56.985UTC WARN [on-core-akka.actor.default-dispatcher-7] ExternalAgentHandler - Malformed odf received from agent Actor[akka://on-core/system/IO-TCP/selectors/$a/3#-1637407092]: ParseError(OdfParser: Invalid XML, schema failure: cvc-elt.1: Cannot find the declaration of element 'Objects'.)

I have also tried to change the off_message, here is an example that I have used:

<?xml version="1.0" encoding="UTF-8"?>
<Objects xmlns:xs="http://www.w3.org/2001/XMLSchema-instance" xmlns="odf.xsd" xs:schemaLocation="odf.xsd odf.xsd">  
    <Object>
        <id>ExampleAgent</id>
        <InfoItem name="ExampleAgentSensor">
            <value>2</value>
        </InfoItem>
    </Object>
</Objects>

But, again I get the same warning!

I would be grateful for any help!!! Prodromos

TK009 commented 8 years ago

Thank you for the report. Your O-DF is indeed valid. It seems that the parser currently doesn't understand the xml preamble (the first line "<?xml ..."). For a workaround you can try it without that for now.

buda2000 commented 8 years ago

Check the latetest version of python external agent. I added xmlns="odf.xsd" in the Objects tag. It should be work. Let us know if it doesn't.

Jupeti10 commented 8 years ago

XML parser didn't allow white space before the XML declaration "<?xml...". Added fix to the latest version in master branch.