Pedro Felix on Sun, 01 Jul 2012 23:53:30
Arwind - MSFT on Mon, 02 Jul 2012 08:55:49
Try to encode the xml document into a binary stream on the client side and then send to the service. If you don’t want to binary encode it, then you don’t need stream mode at all. Streaming mode allows you to send binary data as is, without encoding it to xml or JSON. That’s the advantage.
Hope this helps.
Pedro Felix on Mon, 02 Jul 2012 13:44:55
Thanks for your response. However:
1) I do not control the clients. They are "generic" HTTP clients that do POST requests using bodies with different media types (e.g. form url encoding, xml, json, image).
2) At the service side, I want to always access the POST body via a stream, independently of the media type.
Arwind - MSFT on Tue, 03 Jul 2012 02:36:56
According to http://social.msdn.microsoft.com/Forums/en-US/windowsazureconnectivity/thread/74fc44cf-ef45-441f-b187-23303e8d701b, WebContentTypeMapper works fine in Service Bus. Can you try again?
Pedro Felix on Tue, 03 Jul 2012 21:57:25
Yes, I confirm that the WebContentTypeMapper is *not* called.
I'm using a custom binding built like this
public Binding GetBinding()
var b = new WebHttpRelayBinding(EndToEndWebHttpSecurityMode.None, RelayClientAuthenticationType.None);
var elems = b.CreateBindingElements();
var ee = elems.Find<WebMessageEncodingBindingElement>();
ee.ContentTypeMapper = new RawContentTypeMapper();
return new CustomBinding(elems);
If the POST request contains a "application/json" body, then the RawContentTypeMapper *is* called.
However, if the POST request contains a "application/xml" body, then the RawContentTypeMapper *is not* called. In this case, I get the following in the trace log
Incoming message for operation 'Invoke' (contract 'DispatcherService' with namespace 'http://tempuri.org/') does not contain a WebBodyFormatMessageProperty. This can be because a WebContentTypeMapper or a WebMessageEncodingBindingElement has not been configured on the binding. See the documentation of WebContentTypeMapper and WebMessageEncodingBindingElement for more details.
Allen Chen - MSFT on Thu, 19 Jul 2012 08:29:45
I remember the service bus does alter the message so I wrote a sample to show how to alter message back before handling data. Not sure whether it still behave the same way now but you may have a look at my sample (mainly pay attention to my custom IDispatchMessageInspector):
Allen Chen [MSFT]
MSDN Community Support | Feedback to us
Get or Request Code Sample from Microsoft
Please remember to mark the replies as answers if they help and unmark them if they provide no help.