[英]RX UDPClient that listeners for messages from devices from a list of ports and subscribes to data to post to Azure Event Hub
[英]POST data on Azure Event hub is failing
這是關於 Azure 事件中心,我正在嘗試使用 POST api 調用從 POSTMAN 向我的事件中心發送數據。
我遵循的步驟:
創建事件中心,生成 SAS 發送令牌,創建消費者組
現在在 postman 我正在努力格式化正確的標題:
我發送的請求:
POST: https://testeventhu.servicebus.windows.net/myhub
2個標題:
Content-Type : application/atom+xml;type=entry;charset=utf-8
Authorization: SharedAccessSignature sig=kjheh/f6SqR8dIW2nRpGUCHuhdshss2KoCKo7Q6ozmY=&se=1571140739&skn=saspolicy&sr=https://testeventhu.servicebus.windows.net/myhub
我得到錯誤 401 MalformedToken: Failed to parse simple web token
我在這里做錯了什么?使用的參考來自https://docs.microsoft.com/en-us/rest/api/eventhub/Send-event?redirectedfrom=MSDN
提前致謝
請按照我的步驟如下:
1 .After you create your eventhub namesapce
and eventhub
instance in azure portal -> in azure portal, nav to your eventhub namespace
-> Shared access policies, click "Add" button to create a sas policy(here, I just select the Send privilege用於發送目的)。 截圖如下:
2 .生成 sas 令牌,我按照此鏈接通過 powershell 創建 sas 令牌。 這是我的 powershell 代碼和返回的 sas 令牌:
3.在 postman 中:
請求 url 應該是這樣的,記得在最后添加messages
: https://your_eventhub_namespace.servicebus.windows.net/your_eventhub_instance/messages
標題:
授權:來自步驟 2 的 sas 令牌
內容類型:application/atom+xml;type=entry;charset=utf-8
主機(可選):your-eventhub-namespace.servicebus.windows.net
截圖如下,可以看到返回的狀態碼是 201 created:
如果您不知道如何設置消息正文,您可以在 postman 的正文中查看我的消息:
如果您仍有任何問題,請隨時告訴我。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.