Namespace not attaching to bool in WCF unless different from class's Namespace

Hasann

New Member
I have a datatype I'm using in WCF for sending a SOAP response. It looks like this:\[code\]<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"> <s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <start-call-recording-response xmlns="http://foobar"> <response>true</response> </start-call-recording-response> </s:Body></s:Envelope>\[/code\]The issue is that the namespace (\[code\]http://foobar\[/code\]) is not appearing in the element. That is, UNLESS I change the XmlElementAttibute's Namespace to something different from the parent class's XmlRootAttribute's Namespace. Here is the class for start-call-recording-response:\[code\]/// <remarks/>[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Xml", "4.0.30319.18033")][System.SerializableAttribute()][System.Diagnostics.DebuggerStepThroughAttribute()][System.ComponentModel.DesignerCategoryAttribute("code")][System.Xml.Serialization.XmlTypeAttribute(TypeName = "StartcallrecordingresponseType")][System.Xml.Serialization.XmlRootAttribute(Namespace = "http://foobar", ElementName = "start-call-recording-responseType")]public partial class StartcallrecordingresponseType{ [System.ServiceModel.MessageBodyMemberAttribute(Namespace = "http://foobar")] private bool responseField; /// <remarks/> [System.Xml.Serialization.XmlElementAttribute(Namespace = "http://foobar", ElementName = "response", IsNullable = false)] public bool Response { get { return this.responseField; } set { this.responseField = value; } }}\[/code\]If I change the XmlElementAttribute's Namespace above Response to something other than the namespace of the containing class, it will appear in the SOAP envelope's . If they're the same, it doesn't appear. Tried many variations of XmlTypeAttributes, XmlRootAttributes, and XmlElementAttributes.
 
Back
Top