AXL Generate Class and Parse Get Annunciator

Version 1
    This document was generated from CDN thread

    Created by: Dennis Heim on 12-11-2013 10:04:57 PM
    I am doing this in C#, but my question is really about using the XSD/generate code to parse out the returned results.

    In order to get the annunciator, I used the following code:
    UC.CUCM.AXL.Admin.GetAnnunciatorReq getANN = new GetAnnunciatorReq();
    getANN.ItemElementName =;
    getANN.Item = "ANN_2";

    I then get the result back, and it is a string that is well-formed XML. See Below
    <?xml version='1.0' encoding='UTF-8'?><soapenv:Envelope xmlns:soapenv=""><soapenv:Body><ns:getAnnunciatorResponse xmlns:ns=""><return><annunciator uuid="{B6375FD1-B8E4-4901-A29E-935D1D765CA3}"><name>ANN_2</name><description>ANN_UC9-CUCM1</description><devicePoolName uuid="{1B1B9EB6-7803-11D3-BDF0-00108302EAD1}">Default</devicePoolName><locationName uuid="{29C5C1C4-8871-4D1E-8394-0B9181E8C54D}">Hub_None</locationName><useTrustedRelayPoint>Default</useTrustedRelayPoint><serverName uuid="{D7D5FBB4-F258-46FC-8418-6E425EFDFEA0}"></serverName></annunciator></return></ns:getAnnunciatorResponse></soapenv:Body></soapenv:Envelope>

    Is there a class or object that I can feed that resulting xml back to and access variables instead of parsing the XML? I would like to be able to access it myAnnuncator.Name instead of using xPath to parse that XML.

    Subject: RE: AXL Generate Class and Parse Get Annunciator
    Replied by: Dennis Heim on 12-11-2013 11:37:27 PM
    For those looking for the answer, I needed to deserialize in order to be able to access items by properties such as myAnn.Name.

    The nonsense of xmlDoc2.ChildNodes[1].FirstChild.InnerXml is what is necessary to remove the soapenv:Envelope and soapenv:Body encapsulation. If you don't do this, the deserialization will fail.

    System.Xml.Serialization.XmlSerializer XS1 = new System.Xml.Serialization.XmlSerializer(typeof(GetAnnunciatorRes));
    System.Xml.XmlReader XR = System.Xml.XmlReader.Create(new System.IO.StringReader(xmlDoc2.ChildNodes[1].FirstChild.InnerXml));
    UC.CUCM.AXL.Admin.GetAnnunciatorRes i;
    i = (GetAnnunciatorRes)XS1.Deserialize(XR);