【问题标题】:Sending message to Azure Service Bus from POSTMAN nodeJs从 POSTMAN nodeJs 向 Azure 服务总线发送消息
【发布时间】:2020-10-17 06:56:27
【问题描述】:

我一直在尝试从 POSTMAN 向 Azure 服务总线主题发送示例消息,但它出现了异常错误。我的疑问是,我正在使用 NodeJs 自己的“缓冲区”而不是“utf8”模块生成 SAS 令牌。这是否是我收到 “指定的 HTTP 动词 (POST) 无效”的原因。。这是我用来生成 SAS 令牌的 sn-p。

*function createSharedAccessToken(uri, saName, saKey) {
    if (!uri || !saName || !saKey) {
        throw "Missing required parameter";
    }
    console.log('inside the function')
    var encoded = encodeURIComponent(uri);
    var now = new Date();
    var week = 60 * 60 * 24 * 7;
    var ttl = Math.round(now.getTime() / 1000) + week;
    var signature = encoded + '\n' + ttl;
    var signatureUTF8 = Buffer.from(signature, 'utf8');
    var hash = crypto.createHmac('sha256', saKey).update(signatureUTF8).digest('base64');
    return 'SharedAccessSignature sr=' + encoded + '&sig=' +
        encodeURIComponent(hash) + '&se=' + ttl + '&skn=' + saName;
}*

这是一个带有 Authorization 和 Content-Type 标头的 POST 调用。

【问题讨论】:

  • 能否添加网址?
  • 这里是:https://.servicebus.windows.net/

标签: node.js azure azure-servicebus-topics


【解决方案1】:

请在网址末尾添加“消息”:

http{s}://{serviceNamespace}.servicebus.windows.net/{queuePath|topicPath}/messages

-> https://mynamespace.servicebus.windows.net/my-topic-name/messages

Send Message

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2022-08-05
    • 1970-01-01
    • 2016-02-25
    • 1970-01-01
    • 2013-03-19
    • 1970-01-01
    • 2012-08-28
    相关资源
    最近更新 更多