Today I was taught an immensely important lesson by WCF. It actually has nothing to do with WCF except that because of the size of the schema I'm working with that is where I encountered it. I do a lot of work in the healthcare industry, and that industry, by government mandate, works with a message format called the 837 (properly the X12 4010A1 837 either I, P or D). The 837 has three flavors, and is absolutely huge. I was crafting a service which had to accept an XML representation of this data. How did I create the XML? BizTalk Server 2006 R2's new HIPAA support of course. When I made the call to service from my unit tests I first received a Fault indicating that exception details could not be returned because of configuration. No problem, obviously I've seen this before and so I added the following to my app.Config for the Host executable: <behaviors><serviceBehaviors><behavior name="EnableDebugging"><serviceDebug includeExceptionDetailInFaults="true"/></behavior></serviceBehaviors></behaviors>Now that I've enabled debugging, surely now I'll see some sort of clear reason by this occurred. Nope! I was presented with the following:TheCompany.Services.Tests.ClaimsService.GetListOfClaimsByStatus : System.ServiceModel.FaultException`1[System.ServiceModel.ExceptionDetail] : Error in deserializing body of request message for operation 'GetClaimListByStatus'. Well isn't that terribly useful. Fortunately, this did give me the single most important piece of information "deserializing". So off I go to Google my brain, because I'd written a post before on how to debug the XmlSerializer (and I was using the XmlSerializer in this case because the DataContractSerializer could not work with my schema). As that post will tell you, there is a switch that can be set in the app.Config which will enable you to debug the code generated by the XmlSerializer. So now we add the following to my app.Config:<system.diagnostics><switches><add name="XmlSerialization.Compilation" value="1" /></switches></system.diagnostics>And we follow that by running the unit tests again, that results in something that is actively useful: For those reading along at home and wanting the full text that says:The maximum nametable character count quota (10000) has been exceeded while reading XML data. The nametable is a data structure used to store strings encountered during XML processing - long XML documents with non-repeating element names, attribute names and attribute values may trigger this quota. This quota may be increased by changing the MaxNameTableCharCount property on the XmlDictionaryReaderQuotas object used when creating the XML reader. Now that is useful, it tells me exactly how to correct the problem and the size of the quota currently. The only problem is that I didn't create this XmlReader object, I didn't even create the XmlSerializer which created this XmlReader. The only thing which I create was a ServiceHost, how can I change that setting? Enter Google again.As it happens, Windows Communication Foundation does include an ability to override that value, it is stored in the Binding Configuration in your ... you guessed it ... app.Config! Add the following snippet (assuming you're using Basic Http Binding (it exists for all bindings though) and you'll be good to go:<bindings><basicHttpBinding><binding name="BasicHttpBinding"><readerQuotas maxNameTableCharCount="100000"/></binding></basicHttpBinding></bindings>Now, surely I'm done, and things will work. Actually, no it took me a few times to find a value that would work for that quota. Once I did though I finally hit my breakpoint inside the service and was able to send back a response, where upon I got this message:TheCompany.Services.Tests.ClaimsService.GetListOfClaimsByStatus : System.ServiceModel.CommunicationException : Error in deserializing body of reply message for operation 'GetClaimListByStatus'. ----> System.InvalidOperationException : There is an error in XML document (1, 252). ----> System.Xml.XmlException : The maximum nametable character count quota (10000) has been exceeded while reading XML data. The nametable is a data structure used to store strings encountered during XML processing - long XML documents with non-repeating element names, attribute names and attribute values may trigger this quota. This quota may be increased by changing the MaxNameTableCharCount property on the XmlDictionaryReaderQuotas object used when creating the XML reader. Line 1, position 252.At least when the error occurs on the client side you get the full details to start with! Make the same modification above to your configuration on the client side and you're good to go.
I've spent a lot of time this summer traveling to various events and presenting my talk "Introduction to C# 3.0" to people throughout the South Central area of the United States. Well, it pains me to say I'm but one man, and there are way way way way to many of you to reach through this manual process. Fortunately for me, there are technological solutions to this problem : The Internet! I've spent some time today recording my first of what I hope to be several webcasts. These webcasts are made possible through the generation gift of a Camtasia license from TechSmith. I've been a fan of Camtasia for many years, and the latest versions are a joy to work with. All of that said, following this link to the Land of Oz and an Introduction to C# 3.0.
Recently the time had come to upgrade my MP3 player. For Christmas I had gotten a Video iPod from my wonderful wife, but it was stolen a short time later from my truck and I've been without a portable MP3 player since then. Well a new client was suddenly a 45 minute commute, one way, and that sealed the deal that it was time to get something which I could use to travel with Audible books. Enter the Creative Zen V Plus. Having learned from my mistake, I was not going to spent another several hundred dollars on a device, the goal was less than 100 dollars with the requirements that it play Audible, store at least 1 gigabyte, and be reliable. The Zen V Plus more than fit the bill, for just over $75 dollars you can get: 2 gigabytes of storage FM Tuner Audio Recorder (with Built In Microphone) Line-In Audio Recorder VIDEO player on 1.5" screen (Low Res, but any video is a plus) Simple and easy to follow interface Now overall I've loved the device, but there are a few things I wish it did better. The biggest is that a couple of times it has lost the place in my Audiobook when it did an idle shutdown. You know, you pause because you need to focus on work for a bit, and then hours later come back but in the meantime after 30 minutes of no action it shutdown. This is to me somewhat unforgiveable, but I've been able to work around it for the most part, hopeful a future firmware upgrade will address this. Overall, 4 out of 5 stars.