简体   繁体   中英

Proton Orion Subscription - Error when parsing notification XML

I had configured Orion and Proton FIWARE Generic Enablers and made a subscription in Orion to send a notification to Proton when an entity of type Node is modified.

It happens that Proton is returning an error related with the parsing of the received XML.

proton | Mar 02, 2016 11:46:47 AM com.ibm.hrl.proton.webapp.providers.EventXmlNgsiMessageReader readFrom
proton | INFO: started event message body reader
proton | Mar 02, 2016 11:46:47 AM com.ibm.hrl.proton.webapp.providers.EventXmlNgsiMessageReader readFrom
proton | INFO: Event: NodeContextUpdate
proton | Mar 02, 2016 11:46:47 AM com.ibm.hrl.proton.webapp.providers.EventXmlNgsiMessageReader readFrom
proton | SEVERE: Could not parse XML NGSI event java.lang.NullPointerException, reason: null
proton |  last attribute name: null last value: null

I found that at least another user had posted a similar question but the answer to that question does not fits (and solve) my situation.

EDIT:

Here is the POST request that Proton has received:

........POST /ProtonOnWebServer/rest/events HTTP/1.1
User-Agent: orion/0.27.0-next libcurl/7.19.7
Host: 192.168.99.100:8080
Accept: application/xml, application/json
Content-length: 901
Content-type: application/xml

<notifyContextRequest>
  <subscriptionId>570b7cad849a7fd6c9ebaaf3</subscriptionId>
  <originator>localhost</originator>
  <contextResponseList>
    <contextElementResponse>
      <contextElement>
        <entityId type="Node" isPattern="false">
          <id>Node3</id>
        </entityId>
        <contextAttributeList>
          <contextAttribute>
            <name>temperature</name>
            <type>double</type>
            <contextValue>23</contextValue>
          </contextAttribute>
          <contextAttribute>
            <name>pressure</name>
            <type>double</type>
            <contextValue>15</contextValue>
          </contextAttribute>
        </contextAttributeList>
      </contextElement>
      <statusCode>
        <code>200</code>
        <reasonPhrase>OK</reasonPhrase>
      </statusCode>
    </contextElementResponse>
  </contextResponseList>
</notifyContextRequest>

Thank you.

Just for the sake of others who look this thread up, here is Jose's explanation to his resolution of this problem. I hope Jose is ok with that:

The first time I've run into an similar error, I was not making the subscription in Orion to send the information in XML format. The solution was to use "Accept":"application/xml" it the header of the subscription POST resquest in order to Orion to notify Proton in XML NGSI. (The reason XML should be used is because the JSON format accepted by Proton is not NGSI).

This time I was just forgetting to put entityType attribute in the NodeContextUpdate event definition.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM