[英]Proton Orion Subscription - Error when parsing notification XML
我已經配置了Orion和Proton FIWARE通用啟動器,並在Orion中進行了訂閱,以便在修改Node類型的實體時向Proton發送通知。
發生Proton返回與解析接收到的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
我發現至少另一個用戶發布了類似的問題,但是該問題的答案不適合(無法解決)我的情況。
編輯:
這是Proton收到的POST請求:
........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>
謝謝。
僅出於其他人的考慮,這是何塞對他解決這個問題的解釋。 我希望Jose對此表示滿意:
第一次遇到類似錯誤時,我不是在Orion中進行訂閱以發送XML格式的信息。 解決方案是在訂閱POST請求的標頭中使用“ Accept”:“ application / xml”,以便Orion在XML NGSI中通知Proton。 (應使用XML的原因是Proton接受的JSON格式不是NGSI)。
這次,我只是忘記將實體類型屬性放在NodeContextUpdate事件定義中。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.