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>
I was getting format errors calling the AsString property because the message returned from the storage queue was, by default, base64 encoded.
The CloudQueue object has an EncodeMessage property that was set to true. Switched it to false and everything worked. Here's my code:
ClientQueueName being a string holding the name of my queue on Azure. I'm thinking that the property needs to be set to false in your case before sending as well.