【问题标题】:Orion JSON Bad RequestOrion JSON 错误请求
【发布时间】:2016-01-11 20:42:41
【问题描述】:

我目前正在尝试订阅 Orion 和 Cosmos。发送到 Orion 的所有数据都在更新,没有任何问题。但是,当发布到 http://xxx.xxx.xx.xx:1026/v1/subscribeContext 时,我收到以下错误:

{
  "subscribeError": {
    "errorCode": {
      "code": "400",
      "reasonPhrase": "Bad Request",
      "details": "JSON Parse Error"
    }
  }
}

这是我要发送的 json 字符串:

{
  "entities": [
    {
      "type": "Location",
      "isPattern": "false",
      "id": "Device-1"
    }
  ],
  "reference": "http://52.31.144.170:5050/notify",
  "duration": "PT10S",
  "notifyConditions": [
    {
      "type": "ONCHANGE",
      "condValues": [
        "position"
      ]
    }
  ],
  "attributes": [
    "position"
  ]
}

Orion 中更新 OK 的实体是:

{
  "type": "Location",
  "isPattern": "false",
  "id": "Device-1",
  "attributes": [
    {
      "name": "position",
      "type": "coords",
      "value": "24,21",
      "metadatas": [
        {
          "name": "location",
          "type": "string",
          "value": "WGS84"
        }
      ]
    },
    {
      "name": "id",
      "type": "device",
      "value": "1"
    }
  ]
}

我尝试了 readthedocs 中的许多不同示例,但 StackOverflow 中的其他响应均未成功。

哪种格式正确?我应该在使用 /contextEntities 更新 Orion 之前还是之后调用 /subscribeContext?

Orion Context Broker 版本为 0.26.1。

提前谢谢你。

【问题讨论】:

  • 我已经基于 curl 进行了快速测试,您使用的逐字消息似乎没问题(请参阅gist.github.com/fgalan/f0f44d5113fa88e4825a)。请您做同样的测试以检查它在您的机器中的运行情况吗?

标签: fiware fiware-orion fiware-cygnus


【解决方案1】:

考虑到使用 curl 发送时相同的有效负载可以正常工作(请参阅execution session),我倾向于认为客户端中的某些问题(可能被编程框架隐藏?)导致了问题。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2023-03-20
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-10-15
    • 1970-01-01
    相关资源
    最近更新 更多