I don't have the possibility to encode my request to base64, and according to the documentation I shouldn't have to, but I can't figure it out.
If I Base64 encode it's working fine:
<QueueMessage>
<MessageText>PHNhbXBsZT5zYW1wbGUgbWVzc2FnZTwvc2FtcGxlPg==</MessageText>
</QueueMessage>
Which adds the decoded message to the queue:
<sample>sample message</sample>
According to the documentation (https://msdn.microsoft.com/sv-se/library/azure/dd179346.aspx)
A message must be in a format that can be included in an XML request with UTF-8 encoding. To include markup in the message, the contents of the message must either be XML-escaped or Base64-encode. Any XML markup in the message that is not escaped or encoded will be removed before the message is added to the queue.
Trying to add (instead of PHNhbXBsZT5zYW1wbGUgbWVzc2FnZTwvc2FtcGxlPg==):
<sample>sample message</sample>
Succeeds but when trying to view the message in the queue it only responds with:
The input is not a valid Base-64 string as it contains a non-base 64 character, more than two padding characters, or an illegal character among the padding characters.
Does somebody know how send a proper raw xml-escaped request message to the storage queue?
Full request (without keys and names):
POST https://xxxxxxx.queue.core.windows.net/testqueue/messages?sv=2015-04-05&ss=q&srt=sco&sp=a&se=2026-11-11T20:24:03Z&st=2016-11-11T12:24:03Z&spr=https&sig=xxxxxxxxxxxxxxxxx%3D HTTP/1.1
User-Agent: Fiddler
Host: XXXXX.queue.core.windows.net
Content-Type: text/plain
Content-Length: 64
<QueueMessage>
<MessageText><sample>sample message</sample></MessageText>
</QueueMessage>
Storage queues provide a uniform and consistent programming model across queues, tables, and BLOBs – both for developers and for operations teams. Service Bus queues provide support for local transactions in the context of a single queue.
Azure documentation states that Storage queue message cannot exceed 64 KB.
John Donnelly answer. is now out of date. CloudQueue
is now considered legacy and you should be using QueueClient
instead. QueueClient
does not have an EncodeMessage
property but you can specify the MessageEncoding
when injecting the service:
builder.Services.AddAzureClients(builder => {
builder.AddQueueServiceClient(<connection string>)
.ConfigureOptions(o => o.MessageEncoding = QueueMessageEncoding.None);
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With