I need to use the Azure Service Bus REST API for sending messages to Service Bus Topics. On the receiving side I'm using the Azure Service Bus SDK.
Message on the sender side:
POST https://your-namespace.servicebus.windows.net/HttpClientSampleQueue/messages?timeout=60 HTTP/1.1 Authorization: SharedAccessSignature sr=your-namespace&sig=Fg8yUyR4MOmXfHfj55f5hY4jGb8x2Yc%2b3%2fULKZYxKZk%3d&se=1404256819&skn=RootManageSharedAccessKey BrokerProperties: {"Label":"M1","State":"Active"} Content-Type: application/atom+xml;type=entry;charset=utf-8 Host: your-namespace.servicebus.windows.net This is a message.
When reading the message body as message.GetBody<string> an error message is given serialization exception.
I already searched the web and found a possible solution:
Stream stream = message.GetBody<Stream>();
StreamReader reader = new StreamReader(stream);
string str = reader.ReadToEnd();
or as an alternative (instead of converting to string) converting the stream into an XmlDocument
Are hese recommended ways to handle this issue?
Thanks.