ServiceOrientedAnalytics and PostEvent

Apr 20, 2010 at 9:24 PM
Edited Apr 20, 2010 at 9:27 PM

I am receiving following error in WCF Rest service while I am trying to host the Rest Service for MSAF sample by use of ServiceOrientedAnalytics behavior.

The incoming message has an unexpected message format 'Raw'. The expected message formats for the operation are 'Xml', 'Json'. This can be because a WebContentTypeMapper has not been configured on the binding. See the documentation of WebContentTypeMapper for more details.

I saw that the PostEvent method doesn’t define any content type for the POST message. If I changed it and add the ContentType as “application/xml” I get the Demo app events into WCF with the current Microsoft.WebAnalytics.AnalyticsEvent data contract.

As I am reusing the Microsoft.WebAnalytics.AnalyticsEvent data contract in WCF Rest service running on 4, I was wondering if I have to do some more in WCF biding/mapper or is this as the implementation is not tested yet?

As I mention I change the ContentType and I got it going  throw but now I am no longer sure if this would break the contract you have in mind for ServiceOrientedAnalytics. 

Any service sample here would be great to see in order to get some direction for this matter.  :-)


 /// <summary>
        /// Use an HTTP Post event to and put the data in the body of the message
        /// </summary>
        /// <param name="e">the anaytics event arguments</param>
        private void PostEvent(AnalyticsEventArgs e)
            var builder = new StringBuilder();


            if (!string.IsNullOrEmpty(this.AccountId))

            var requestUriString = builder.ToString();

            var request = WebRequest.Create(requestUriString);

           // request.ContentType = "application/xml";
            request.Method = "POST";

            var requestStream = new RequestStream
                AnalyticsEvent = e.AnalyticsEvent,
                Request = request

            request.BeginGetRequestStream(new AsyncCallback(this.OnRequestStream), requestStream);


Apr 21, 2010 at 4:14 AM

That looks like a bug - can you create an issue in the Issue Tracker?



Apr 21, 2010 at 9:04 AM
Edited Apr 21, 2010 at 9:09 AM

Done, see the Wiki Link