[英]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.