IoT Broker 似乎不同意 IoT Discovery
IoT Broker seems to disagree with IoT Discovery
我有下一个配置:
IoTBroker(v.5.2.3) <-----> IotDicovery(v.4.3)
当我发出
GET ***/ngsi10/contextEntities/EntityName***
消息到 IoTBroker 它会自动生成一个
***/ngsi9/discoverContext/Availability***
查询 IoTDiscovery。 IoTDiscovery 然后用
肯定地回答
*200 OK* HTTP message
需要有关 EntityName 的信息。
问题是,当 IoTBroker 做出最终响应时,它会返回 404 NOT FOUND HTTP 消息。
这是 POST HTTP 消息,由 IoTBroker 自动生成到 IoTDiscovery:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<discoverContextAvailabilityRequest>
<entityIdList>
<entityId isPattern="false">
<id>Room</id>
</entityId>
</entityIdList>
<attributeList/>
<restriction>
<attributeExpression>
</attributeExpression>
<scope>
<operationScope>
<scopeType>
IncludeAssociations
</scopeType>
<scopeValue xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xsi:type="xs:string">
SOURCES
</scopeValue>
</operationScope>
</scope>
</restriction>
</discoverContextAvailabilityRequest>
这是 IoTDiscovery 对 IoTBroker 的响应,显然一切正常:
<?xml version="1.0" encoding="UTF-8"?><discoverContextAvailabilityResponse>
<contextRegistrationResponseList>
<contextRegistrationResponse>
<contextRegistration>
<entityIdList>
<entityId type="Room" isPattern="false">
<id>ConferenceRoom</id>
</entityId>
</entityIdList>
<contextRegistrationAttributeList>
<contextRegistrationAttribute>
<name>temperature</name>
<type>degree</type>
<isDomain>false</isDomain>
<metadata>
<contextMetadata>
<name>unit</name>
<type>string</type>
<value/>
</contextMetadata>
</metadata>
</contextRegistrationAttribute>
</contextRegistrationAttributeList>
<providingApplication>http://192.168.100.1:70/tempApplication
...</providingApplication>
</contextRegistration>
</contextRegistrationResponse>
</contextRegistrationResponseList>
<errorCode>
<code>200</code>
<reasonPhrase>OK</reasonPhrase>
<details xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="xs:string">Result</details>
</errorCode>
</discoverContextAvailabilityResponse>
NGSI-10和NGSI-9分别涉及上下文信息和上下文可用性信息。更简单地说,NGSI-10 用于实际数据,而 NGSI-9 提供有关数据提供者的信息。
根据此处的文档 (https://forge.fiware.org/plugins/mediawiki/wiki/fiware/index.php/FI-WARE_NGSI-10_Open_RESTful_API_Specification),以下操作资源是 "Convenience Operation Resource":
/ngsi10/contextEntities/EntityName***
此资源相当于 NGSI-10 queryContext。因此,请查看此处的介绍性课程:https://edu.fiware.org/course/view.php?id=33(幻灯片 10)当您向 IoT Broker 发出 NGSI-10 请求时,后者会通过请求 IoT Discovery 来寻找此类信息的可能提供者。如果 IoT Discovery 回复提供者列表,则 IoT Broker 继续查询数据提供者。然后 IoT Broker 聚合来自数据提供者的所有回复并最终回答请求。
如果任何数据提供者没有此类上下文信息或无法访问,IoT Broker 将回复 404 ContextElement not found。
因此您需要实施 NGSI-10 数据提供程序,它需要通过 NGSI-10 公开上下文。
您应该将 IoT Discovery 中的上下文实体关联到 URL。因此,IoT Broker 将开始向由 IoT Discovery 宣布的 IoT Providers 发送请求。
在这个新指南的 IoT Discovery 中有关于关联过程的更多信息:
http://fiware-iot-discovery-ngsi9.readthedocs.io/en/latest/programmer/programmer/index.html
我有下一个配置:
IoTBroker(v.5.2.3) <-----> IotDicovery(v.4.3)
当我发出
GET ***/ngsi10/contextEntities/EntityName***
消息到 IoTBroker 它会自动生成一个
***/ngsi9/discoverContext/Availability***
查询 IoTDiscovery。 IoTDiscovery 然后用
肯定地回答 *200 OK* HTTP message
需要有关 EntityName 的信息。
问题是,当 IoTBroker 做出最终响应时,它会返回 404 NOT FOUND HTTP 消息。
这是 POST HTTP 消息,由 IoTBroker 自动生成到 IoTDiscovery:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<discoverContextAvailabilityRequest>
<entityIdList>
<entityId isPattern="false">
<id>Room</id>
</entityId>
</entityIdList>
<attributeList/>
<restriction>
<attributeExpression>
</attributeExpression>
<scope>
<operationScope>
<scopeType>
IncludeAssociations
</scopeType>
<scopeValue xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xsi:type="xs:string">
SOURCES
</scopeValue>
</operationScope>
</scope>
</restriction>
</discoverContextAvailabilityRequest>
这是 IoTDiscovery 对 IoTBroker 的响应,显然一切正常:
<?xml version="1.0" encoding="UTF-8"?><discoverContextAvailabilityResponse>
<contextRegistrationResponseList>
<contextRegistrationResponse>
<contextRegistration>
<entityIdList>
<entityId type="Room" isPattern="false">
<id>ConferenceRoom</id>
</entityId>
</entityIdList>
<contextRegistrationAttributeList>
<contextRegistrationAttribute>
<name>temperature</name>
<type>degree</type>
<isDomain>false</isDomain>
<metadata>
<contextMetadata>
<name>unit</name>
<type>string</type>
<value/>
</contextMetadata>
</metadata>
</contextRegistrationAttribute>
</contextRegistrationAttributeList>
<providingApplication>http://192.168.100.1:70/tempApplication
...</providingApplication>
</contextRegistration>
</contextRegistrationResponse>
</contextRegistrationResponseList>
<errorCode>
<code>200</code>
<reasonPhrase>OK</reasonPhrase>
<details xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="xs:string">Result</details>
</errorCode>
</discoverContextAvailabilityResponse>
NGSI-10和NGSI-9分别涉及上下文信息和上下文可用性信息。更简单地说,NGSI-10 用于实际数据,而 NGSI-9 提供有关数据提供者的信息。
根据此处的文档 (https://forge.fiware.org/plugins/mediawiki/wiki/fiware/index.php/FI-WARE_NGSI-10_Open_RESTful_API_Specification),以下操作资源是 "Convenience Operation Resource":
/ngsi10/contextEntities/EntityName***
此资源相当于 NGSI-10 queryContext。因此,请查看此处的介绍性课程:https://edu.fiware.org/course/view.php?id=33(幻灯片 10)当您向 IoT Broker 发出 NGSI-10 请求时,后者会通过请求 IoT Discovery 来寻找此类信息的可能提供者。如果 IoT Discovery 回复提供者列表,则 IoT Broker 继续查询数据提供者。然后 IoT Broker 聚合来自数据提供者的所有回复并最终回答请求。 如果任何数据提供者没有此类上下文信息或无法访问,IoT Broker 将回复 404 ContextElement not found。
因此您需要实施 NGSI-10 数据提供程序,它需要通过 NGSI-10 公开上下文。
您应该将 IoT Discovery 中的上下文实体关联到 URL。因此,IoT Broker 将开始向由 IoT Discovery 宣布的 IoT Providers 发送请求。
在这个新指南的 IoT Discovery 中有关于关联过程的更多信息: http://fiware-iot-discovery-ngsi9.readthedocs.io/en/latest/programmer/programmer/index.html