Why does WCF wrap request/response types in another XML element, and how to prevent this?

依然范特西╮ 提交于 2019-11-30 21:44:58

IIRC, WCF by default uses the 'Wrapped' message style. If you want to be able to control how messages are serialized, you can define explicit messages by decorating with the MessageContractAttribute. With explicit message contracts, you can set the IsWrapped property to false.

In your case I think that EchoRequest and EchoResponse shouldn't be DataContracts at all, but rather MessageContracts. They look a lot like MessageContracts to me.

codekaizen

I eventually switched over to use Message Contracts using a TypedMessageConverter which I was introduced to via this question's answer. That was the missing piece here.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!