我发现我必须有另一个 GE,物联网配置管理器与物联网代理并行工作,以便管理我们将从中获取数据的实体。现在,XMLValidator 代码似乎给我带来了一些麻烦。我通过 HTTP POST osgi9 直接向配置管理器注册了一个实体。然后我尝试通过 osgi10 与 IoT 代理通信来访问它。IoT Broker 与 IoT DIScovery 服务通信并获得响应,但随后 XMLValidator 说 XML 是错误的,即使它显然不是。
这是 IoT 代理向 IoT ConfMan 请求资源的可用性:
2014-11-27 10:31:13,682 | INFO | (HttpConnectionClient.java:initializeConnection:170) | Output
Stream: <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<discoverContextAvailabilityRequest>
<entityIdList>
<entityId isPattern="false">
<id>Dorm</id>
</entityId>
</entityIdList>
<attributeList/>
<restriction>
<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>
然后 IoT Broker 获得:
2014-11-27 10:31:13,947 | INFO | (HttpConnectionClient.java:initializeConnection:188) |
<?xml version="1.0" encoding="UTF-8"?><discoverContextAvailabilityResponse>
<contextRegistrationResponseList>
<contextRegistrationResponse>
<contextRegistration>
<entityIdList>
<entityId type="Room" isPattern="false">
<id>Dorm</id>
</entityId>
</entityIdList>
<contextRegistrationAttributeList>
<contextRegistrationAttribute>
<name>temperature</name>
<type>degree</type>
<isDomain>false</isDomain>
<metadata>
<contextMetadata>
<name>ID</name>
<type>string</type>
<value/>
</contextMetadata>
<contextMetadata>
<name/>
<type/>
<value/>
</contextMetadata>
</metadata>
</contextRegistrationAttribute>
</contextRegistrationAttributeList>
<providingApplication>http://192.168.100.1:70
</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>
2014-11-27 10:31:13,949 | INFO | (HttpConnectionClient.java:initializeConnection:218) | Connection Closed!
2014-11-27 10:31:13,987 | INFO | (XmlValidator.java:error:128) |
ERROR
org.xml.sax.SAXParseException; lineNumber: 0; columnNumber: 0; cvc-complex-type.2.4.b: The content of element 'contextRegistration' is not complete. One of '
{registrationMetaData, providingApplication}
' is expected.
收到的 xml 清楚地看到,至少收到了providingApplication,但 XMLValidator 没有看到这一点。