1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132
| XmlDocument doc = new XmlDocument();
XmlNode docNode = doc.CreateXmlDeclaration("1.0", "UTF-8", null);
doc.AppendChild(docNode);
XmlNode Envelope = doc.CreateElement("SOAP-ENV", "Envelope", "http://schemas.xmlsoap.org/soap/envelope/");
XmlAttribute soapenc = doc.CreateAttribute("soapenc", "xmlns", "http://schemas.xmlsoap.org/soap/encoding/");
XmlAttribute tns = doc.CreateAttribute("tns", "xmlns", "http://schemas.cisco.com/ast/soap/");
XmlAttribute types = doc.CreateAttribute("types", "xmlns", "http://schemas.cisco.com/ast/soap/encodedTypes");
XmlAttribute xsd = doc.CreateAttribute("xsd", "xmlns", "http://www.w3.org/2001/XMLSchema");
XmlAttribute xsi = doc.CreateAttribute("xsi", "xmlns", "http://www.w3.org/2001/XMLSchema-instance");
Envelope.Attributes.Append(soapenc);
Envelope.Attributes.Append(soapenc);
Envelope.Attributes.Append(tns);
Envelope.Attributes.Append(types);
Envelope.Attributes.Append(xsd);
Envelope.Attributes.Append(xsi);
doc.AppendChild(Envelope);
XmlNode Header = doc.CreateElement("SOAP-ENV", "Header", "http://schemas.xmlsoap.org/soap/envelope/" );
Envelope.AppendChild(Header);
XmlNode AstHeader = doc.CreateElement("tns", "AstHeader", "http://schemas.cisco.com/ast/soap/");
XmlAttribute xmlID = doc.CreateAttribute("id");
xmlID.Value = "id1";
AstHeader.Attributes.Append(xmlID);
Header.AppendChild(AstHeader);
XmlNode SessionId = doc.CreateElement("SessionId");
XmlAttribute xsiType = doc.CreateAttribute("xsi", "type", "http://www.w3.org/2001/XMLSchema-instance");
xsiType.Value = "xsd:string";
SessionId.Attributes.Append(xsiType);
SessionId.AppendChild(doc.CreateTextNode("SessionId")); //valeur à l'intérieur
AstHeader.AppendChild(SessionId);
XmlNode Body = doc.CreateElement("SOAP-ENV", "Body", "http://schemas.xmlsoap.org/soap/envelope/");
XmlAttribute encodingStyle = doc.CreateAttribute("encodingStyle");
encodingStyle.Value = "http://schemas.xmlsoap.org/soap/encoding/";
Body.Attributes.Append(encodingStyle);
Envelope.AppendChild(Body);
XmlNode SelectCmDevice = doc.CreateElement("tns", "SelectCmDevice", "http://schemas.cisco.com/ast/soap/");
Body.AppendChild(SelectCmDevice);
XmlNode CmSelectionCriteria = doc.CreateElement("CmSelectionCriteria");
XmlAttribute href = doc.CreateAttribute("href");
href.Value = "#id1";
CmSelectionCriteria.Attributes.Append(href);
SelectCmDevice.AppendChild(CmSelectionCriteria);
XmlNode CmSelectionCriteriaTNS = doc.CreateElement("tns", "CmSelectionCriteria", "http://schemas.cisco.com/ast/soap/");
xmlID = doc.CreateAttribute("id");
xmlID.Value = "id1";
xsiType = doc.CreateAttribute("xsi", "type", "http://www.w3.org/2001/XMLSchema-instance");
xsiType.Value = "tns:CmSelectionCriteria";
CmSelectionCriteriaTNS.Attributes.Append(xmlID);
CmSelectionCriteriaTNS.Attributes.Append(xsiType);
Body.AppendChild(CmSelectionCriteriaTNS);
XmlNode MaxReturnedDevices = doc.CreateElement("MaxReturnedDevices");
xsiType = doc.CreateAttribute("xsi", "type", "http://www.w3.org/2001/XMLSchema-instance");
xsiType.Value = "xsd:unsignedInt";
MaxReturnedDevices.Attributes.Append(xsiType);
MaxReturnedDevices.AppendChild(doc.CreateTextNode("4294967295"));
CmSelectionCriteriaTNS.AppendChild(MaxReturnedDevices);
XmlNode Class = doc.CreateElement("Class");
xsiType = doc.CreateAttribute("xsi", "type", "http://www.w3.org/2001/XMLSchema-instance");
xsiType.Value = "xsd:string";
Class.Attributes.Append(xsiType);
Class.AppendChild(doc.CreateTextNode("Phone"));
CmSelectionCriteriaTNS.AppendChild(Class);
XmlNode Model = doc.CreateElement("Model");
xsiType = doc.CreateAttribute("xsi", "type", "http://www.w3.org/2001/XMLSchema-instance");
xsiType.Value = "xsd:unsignedInt";
Model.Attributes.Append(xsiType);
Model.AppendChild(doc.CreateTextNode("255"));
CmSelectionCriteriaTNS.AppendChild(Model);
XmlNode Status = doc.CreateElement("Status");
xsiType = doc.CreateAttribute("xsi", "type", "http://www.w3.org/2001/XMLSchema-instance");
xsiType.Value = "xsd:string";
Status.Attributes.Append(xsiType);
Status.AppendChild(doc.CreateTextNode("Any"));
CmSelectionCriteriaTNS.AppendChild(Status);
XmlNode SelectBy = doc.CreateElement("SelectBy");
xsiType = doc.CreateAttribute("xsi", "type", "http://www.w3.org/2001/XMLSchema-instance");
xsiType.Value = "tns:CmSelectBy";
SelectBy.Attributes.Append(xsiType);
SelectBy.AppendChild(doc.CreateTextNode("Name"));
CmSelectionCriteriaTNS.AppendChild(SelectBy);
XmlNode SelectItems = doc.CreateElement("SelectItems");
href = doc.CreateAttribute("href");
href.Value = "#id2";
SelectItems.Attributes.Append(href);
CmSelectionCriteriaTNS.AppendChild(SelectItems);
XmlNode soapencArray = doc.CreateElement("soapenc", "Array", "http://schemas.xmlsoap.org/soap/encoding/");
xmlID = doc.CreateAttribute("id");
xmlID.Value = "id2";
XmlAttribute ArrayType = doc.CreateAttribute("soapenc", "arrayType", "http://schemas.xmlsoap.org/soap/encoding/");
ArrayType.Value = "tns:SelectItem[1]";
soapencArray.Attributes.Append(xmlID);
soapencArray.Attributes.Append(ArrayType);
Body.AppendChild(soapencArray);
XmlNode Item = doc.CreateElement("Item");
href = doc.CreateAttribute("href");
href.Value = "#id3";
Item.Attributes.Append(href);
soapencArray.AppendChild(Item);
XmlNode SelectItem = doc.CreateElement("tns", "SelectItem", "http://schemas.cisco.com/ast/soap/");
xmlID = doc.CreateAttribute("id");
xmlID.Value = "id3";
xsiType = doc.CreateAttribute("xsi", "type", "http://www.w3.org/2001/XMLSchema-instance");
xsiType.Value = "tns:SelectItem";
SelectItem.Attributes.Append(xmlID);
SelectItem.Attributes.Append(xsiType);
Body.AppendChild(SelectItem);
Item = doc.CreateElement("Item");
xsiType = doc.CreateAttribute("xsi", "type", "http://www.w3.org/2001/XMLSchema-instance");
xsiType.Value = "xsd:string";
Item.Attributes.Append(xsiType);
//Item.AppendChild(doc.CreateTextNode("*")); // Si on les veut tous...
Item.AppendChild(doc.CreateTextNode(phoneName)); // <---- Ici on place le nom de la recherche du téléphone ciblé.
SelectItem.AppendChild(Item);
Request = doc.InnerXml; |