2016-03-02 42 views
0

我配置了Orion和Proton FIWARE Generic Enablers,並在Orion中進行訂閱,以便在Node類型的實體被修改時向Proton發送通知。Proton Orion訂閱 - 解析通知XML時出錯

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 

我發現至少有另一位用戶發佈了類似的問題,但該問題的答案不符合(並解決)我的情況。

編輯:

這裏是騰已收到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> 

謝謝。

回答

0

只是爲了看看這個主題的其他人,這裏是Jose對他解決這個問題的解釋。我希望何塞是確定與:

第一次我碰到一個類似的錯誤,我不是在獵戶座使得 訂閱發送XML格式的信息。 解決方案是使用「Accept」:「application/xml」它訂閱POST請求的頭部,以便Orion通過NGSI以XML格式通知Proton 。 (應該使用XML的原因是Proton接受的JSON格式 不是NGSI)。

這次我只是忘了將entityType屬性放在 NodeContextUpdate事件定義中。