到目前为止,我一直在使用Fi-Lab / Cloud创建的独立模式中使用上下文代理实例并使用psb-orion-image . 现在我想用http // orion.lab.fi-ware.org联合该CB的一个实例 . 我使用XML表单来创建,更新......并且要联合的实例的名称是“UPCT:TEMPERATURE:SENSOR”,传感器类型是“UPCT:SENSOR” .
所以,通过SSH连接我发送下一个表单:
(curl localhost:1026/NGSI10/subscribeContext -s -S --header 'Content-Type: application/xml' -d @- | xmllint --format -) <<EOF
<?xml version="1.0"?>
<subscribeContextRequest>
<entityIdList>
<entityId type="UPCT:SENSOR" isPattern="false">
<id>UPCT:TEMPERATURE:SENSOR</id>
</entityId>
</entityIdList>
<reference>http://orion.lab.fi-ware.eu:1026/ngsi10/notifyContext</reference>
<duration>P1M</duration>
<notifyConditions>
<notifyCondition>
<type>ONCHANGE</type>
<condValueList>
<condValue>temperature</condValue>
</condValueList>
</notifyCondition>
</notifyConditions>
<throttling>PT5S</throttling>
</subscribeContextRequest>
EOF
我得到一个正确的回复,有和订阅ID . 但是,如果我更新我的实例的de contextValue并尝试向http://orion.lab.fi.ware.eu:1026发送查询,则会收到错误消息:
- :1:解析器错误:期望开始标记,未找到'<'未在请求标头^中找到Auth-token
我想我应该得到与我的实例更新相同的值,如图所示
我需要知道什么是错的,我怎么能联邦政府到全球CB .
谢谢
1 回答
该错误消息是由于发送到orion.lab.fi-ware.org上的Orion实例的任何请求(包括其他Orion实例发送的通知)必须使用身份验证 . 目前(即版本0.14.1),Orion不包括通知中的身份验证所需的X-Auth-Token(请参阅quick start for programmers) .
但是,通常的用例是orion.lab.fi-ware.org上的Orion与私有Orion用户实例(即orion.lab.fi-ware.org - >你的猎户座)联合而不是相反的方式(即你的猎户座 - > orion.lab.fi-ware.org)正如你所想的那样 . 这样做通常您要做的是将公共信息(例如桑坦德城市传感器)与私人信息(例如您的传感器产生的信息)合并 . 联合orion.lab.fi-ware.org - >你的猎户座应该这样完美 .
EDIT: Orion 0.14.1中的限制已被克服当前Orion版本(2.0.0)在通知中传播X-Auth-Token标头(我不记得0.14.1和2.0.0之间的确切版本,对不起 . ..)