2016-01-11 101 views
3

我正在嘗試訂閱Orion和Cosmos。發送給Orion的所有數據都會在沒有任何問題的情況下更新。但是,發佈到http://xxx.xxx.xx.xx:1026/v1/subscribeContext的時候,我發現了以下錯誤:Orion JSON Bad Request

{ 
    "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" 
    ] 
} 

獵戶更新確定的實體是:

{ 
    "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中的其他響應失敗。

這是哪個版本的?我應該在/ or contextEntities更新Orion之前還是之後調用/ subscribeContext?

Orion上下文代理版本是0.26.1。

預先感謝您。

+0

我已經完成了一個基於curl的快速測試,您使用的逐字消息似乎沒問題(請參閱https://gist.github.com/fgalan/f0f44d5113fa88e4825a)。請問您可以進行相同的測試以檢查機器的運行情況嗎? – fgalan

回答

0

考慮到當使用curl發送時,相同的有效負載工作正常(請參閱此execution session)我傾向於認爲客戶端中的某些問題(可能是由編程框架隱藏?)導致問題。