我一直试图从POSTMAN向Azure Service Bus主题发送示例消息,但是它带有一个异常错误。我的疑问是,我正在使用NodeJ自己的“缓冲区”而不是“ utf8”模块生成SAS令牌。这就是为什么我“指定的HTTP动词(POST)无效”的原因。。这是我生成SAS令牌的代码段。
*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调用。
答案 0 :(得分:1)
请在网址末尾添加“消息”:
http {s}:// {{serviceNamespace} .servicebus.windows.net / {queuePath | topicPath} / messages
-> https://mynamespace.servicebus.windows.net/my-topic-name/messages