in Uncategorized

System.ServiceModel.Web: be aware of differences in element names when using BodyStyle Bare vs. Wrapped

I’ve been doing a lot of digging around System.ServiceModel.Web lately and have come across a subtle difference in the way the XML is produced for POX endpoints when switching between BodyStyle.Bare and BodyStyle.Wrapped[Response].

The quick and dirty explanation, if you’re using Bare and you return a DataContract with Name=”Foo”, the name of root element returned will be “Foo”. If you’re using Wrapped however, the root element will be a wrapper element named “<YourMethod>Response” and that will contain a child element named which will be name “<YourMethod>Result” instead of “Foo”. For full details, including sample XML output, check out this thread I started over in the WCF MSDN forums.

Leave a comment