使用最新的开发版本:
我已为某个属性注册了上下文提供程序。当询问属性时,通过返回
的POST请求询问上下文提供程序curl -v --request POST http://130.206.83.68/ngsi10/queryContext
* About to connect() to 130.206.83.68 port 80 (#0)
* Trying 130.206.83.68... connected
> POST /ngsi10/queryContext HTTP/1.1
> User-Agent: curl/7.22.0 (x86_64-pc-linux-gnu) libcurl/7.22.0 OpenSSL/1.0.1 zlib/1.2.3.4 libidn/1.23 librtmp/2.3
> Host: 130.206.83.68
> Accept: */*
>
< HTTP/1.1 200 OK
< X-Powered-By: Express
< Content-Type: application/json; charset=utf-8
< Content-Length: 206
< Date: Fri, 27 Mar 2015 11:09:05 GMT
< Connection: keep-alive
<
* Connection #0 to host 130.206.83.68 left intact
* Closing connection #0
{"contextResponses":[{"contextElement":
{"isPattern":false,"id":"Madrid","type":"Ciudad",
"attributes":[{"name":"population7","value":"6000","type":"string"}]},
"statusCode": {"code":200,"reasonPhrase":"OK"}}]}
但Orion无法识别响应,并显示以下跟踪:
INFO @ 10:59:36 clientSocketHttp.cpp [154]:启动事务到130.206.83.68:80/ngsi10/queryContext
INFO @ 10:59:36 clientSocketHttp.cpp [364]:通知成功发送到130.206.83.68:80/ngsi10/queryContext
INFO @ 10:59:36 clientSocketHttp.cpp [375]:交易结束 警告@ 10:59:36 postQueryContext.cpp [211]:其他错误(对QueryContext的上下文提供程序响应为空)
INFO @ 10:59:36 rest.cpp [383]:交易结束
答案 0 :(得分:0)
这个问题可能是由于当前的Orion版本(0.19.0)假设上下文提供程序始终实现XML呈现。因此,如果您的上下文提供程序在JSON中响应,Orion将无法理解响应。
解决方案是在您的上下文提供程序中实现XML(或等到Orion实现the proper mechanism)。