The main problem was that when I called the webservice (asmx) method with the type, the type always passed as null. A Soap check confirmed that the type was empty. So I tried a simple test. Here is my type, which of course was created from WSDL
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Xml", "4.0.30319.233")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] [System.Xml.Serialization.XmlTypeAttribute(Namespace="http://dto12.api.echosign")] public partial class SendDocumentInteractiveOptions { private bool authoringRequestedField; private bool authoringRequestedFieldSpecified; private bool autoLoginUserField; private bool autoLoginUserFieldSpecified; private bool noChromeField; private bool noChromeFieldSpecified;
Now here is some simple code to serialize it.
SendDocumentInteractiveOptions sdio = new SendDocumentInteractiveOptions(); sdio.authoringRequested = true; sdio.autoLoginUser = true; sdio.noChrome = true; XmlSerializer xmlSer = new XmlSerializer(typeof(SendDocumentInteractiveOptions)); XmlWriter xw = new XmlTextWriter(@"g:\test.xml", null); xmlSer.Serialize(xw, sdio); xw.Close();
And here is the resulting XML
& lt; xml version = "1.0" & gt; & ltSendDocumentInteractiveOptions xmlns: xsd = "http://www.w3.org/2001/XMLSchema" xmlns: xsi = "http://www.w3.org/2001/XMLSchema-instance" / & gt
So what I am missing here. Why aren't my public properties getting serialized?
xml-serialization
Rahul Mar 19 '12 at 19:28 2012-03-19 19:28
source share