MetadataSectionSerializerBase.cs 35 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164
  1. using System;
  2. using System.Xml;
  3. using System.Xml.Schema;
  4. using System.Xml.Serialization;
  5. using System.Text;
  6. using System.Collections;
  7. using System.Globalization;
  8. namespace System.ServiceModel.Description
  9. {
  10. internal class MetadataSectionReaderBase : XmlSerializationReader
  11. {
  12. public object ReadRoot_MetadataSection ()
  13. {
  14. Reader.MoveToContent();
  15. if (Reader.LocalName != "MetadataSection" || Reader.NamespaceURI != "http://schemas.xmlsoap.org/ws/2004/09/mex")
  16. throw CreateUnknownNodeException();
  17. return ReadObject_MetadataSection (true, true);
  18. }
  19. public System.ServiceModel.Description.MetadataSection ReadObject_MetadataSection (bool isNullable, bool checkType)
  20. {
  21. System.ServiceModel.Description.MetadataSection ob = null;
  22. if (isNullable && ReadNull()) return null;
  23. if (checkType)
  24. {
  25. System.Xml.XmlQualifiedName t = GetXsiType();
  26. if (t == null)
  27. { }
  28. else if (t.Name != "MetadataSection" || t.Namespace != "http://schemas.xmlsoap.org/ws/2004/09/mex")
  29. throw CreateUnknownTypeException(t);
  30. }
  31. ob = new System.ServiceModel.Description.MetadataSection ();
  32. Reader.MoveToElement();
  33. int anyAttributeIndex = 0;
  34. System.Collections.ObjectModel.Collection<System.Xml.XmlAttribute> anyAttributeArray = null;
  35. while (Reader.MoveToNextAttribute())
  36. {
  37. if (Reader.LocalName == "Dialect" && Reader.NamespaceURI == "") {
  38. ob.@Dialect = Reader.Value;
  39. }
  40. else if (Reader.LocalName == "Identifier" && Reader.NamespaceURI == "") {
  41. ob.@Identifier = Reader.Value;
  42. }
  43. else if (IsXmlnsAttribute (Reader.Name)) {
  44. }
  45. else {
  46. System.Xml.XmlAttribute attr = (System.Xml.XmlAttribute) Document.ReadNode(Reader);
  47. if (((object)anyAttributeArray) == null)
  48. anyAttributeArray = new System.Collections.ObjectModel.Collection<System.Xml.XmlAttribute>();
  49. anyAttributeArray.Add (((System.Xml.XmlAttribute) attr));
  50. anyAttributeIndex++;
  51. }
  52. }
  53. Reader.MoveToElement();
  54. if (Reader.IsEmptyElement) {
  55. Reader.Skip ();
  56. return ob;
  57. }
  58. Reader.ReadStartElement();
  59. Reader.MoveToContent();
  60. bool b0=false;
  61. while (Reader.NodeType != System.Xml.XmlNodeType.EndElement)
  62. {
  63. if (Reader.NodeType == System.Xml.XmlNodeType.Element)
  64. {
  65. if (Reader.LocalName == "schema" && Reader.NamespaceURI == "http://www.w3.org/2001/XMLSchema" && !b0) {
  66. b0 = true;
  67. ob.@Metadata = ReadObject_XmlSchema (false, true);
  68. }
  69. else if (Reader.LocalName == "Metadata" && Reader.NamespaceURI == "http://schemas.xmlsoap.org/ws/2004/09/mex" && !b0) {
  70. b0 = true;
  71. ob.@Metadata = ((System.ServiceModel.Description.MetadataSet) ReadSerializable (new System.ServiceModel.Description.MetadataSet ()));
  72. }
  73. else if (Reader.LocalName == "Location" && Reader.NamespaceURI == "http://schemas.xmlsoap.org/ws/2004/09/mex" && !b0) {
  74. b0 = true;
  75. ob.@Metadata = ReadObject_MetadataLocation (false, true);
  76. }
  77. else if (Reader.LocalName == "MetadataReference" && Reader.NamespaceURI == "http://schemas.xmlsoap.org/ws/2004/09/mex" && !b0) {
  78. b0 = true;
  79. ob.@Metadata = ((System.ServiceModel.Description.MetadataReference) ReadSerializable (new System.ServiceModel.Description.MetadataReference ()));
  80. }
  81. else if (Reader.LocalName == "definitions" && Reader.NamespaceURI == "http://schemas.xmlsoap.org/wsdl/" && !b0) {
  82. b0 = true;
  83. ob.@Metadata = ReadObject_ServiceDescription (false, true);
  84. }
  85. else {
  86. UnknownNode (ob);
  87. }
  88. }
  89. else
  90. UnknownNode(ob);
  91. Reader.MoveToContent();
  92. }
  93. ReadEndElement();
  94. return ob;
  95. }
  96. public System.Xml.Schema.XmlSchema ReadObject_XmlSchema (bool isNullable, bool checkType)
  97. {
  98. System.Xml.Schema.XmlSchema ob = null;
  99. ob = System.Xml.Schema.XmlSchema.Read (Reader, null); Reader.Read ();
  100. return ob;
  101. }
  102. public System.ServiceModel.Description.MetadataLocation ReadObject_MetadataLocation (bool isNullable, bool checkType)
  103. {
  104. System.ServiceModel.Description.MetadataLocation ob = null;
  105. if (isNullable && ReadNull()) return null;
  106. if (checkType)
  107. {
  108. System.Xml.XmlQualifiedName t = GetXsiType();
  109. if (t == null)
  110. { }
  111. else if (t.Name != "MetadataLocation" || t.Namespace != "http://schemas.xmlsoap.org/ws/2004/09/mex")
  112. throw CreateUnknownTypeException(t);
  113. }
  114. ob = new System.ServiceModel.Description.MetadataLocation ();
  115. Reader.MoveToElement();
  116. while (Reader.MoveToNextAttribute())
  117. {
  118. if (IsXmlnsAttribute (Reader.Name)) {
  119. }
  120. else {
  121. UnknownNode (ob);
  122. }
  123. }
  124. Reader.MoveToElement();
  125. if (Reader.IsEmptyElement) {
  126. Reader.Skip ();
  127. return ob;
  128. }
  129. Reader.ReadStartElement();
  130. Reader.MoveToContent();
  131. bool b1=false;
  132. while (Reader.NodeType != System.Xml.XmlNodeType.EndElement)
  133. {
  134. if (Reader.NodeType == System.Xml.XmlNodeType.Element)
  135. {
  136. UnknownNode (ob);
  137. }
  138. else if (Reader.NodeType == System.Xml.XmlNodeType.Text || Reader.NodeType == System.Xml.XmlNodeType.CDATA)
  139. {
  140. ob.@Location = ReadString (ob.@Location);
  141. }
  142. else
  143. UnknownNode(ob);
  144. Reader.MoveToContent();
  145. }
  146. ReadEndElement();
  147. return ob;
  148. }
  149. public System.Web.Services.Description.ServiceDescription ReadObject_ServiceDescription (bool isNullable, bool checkType)
  150. {
  151. System.Web.Services.Description.ServiceDescription ob = null;
  152. ob = (System.Web.Services.Description.ServiceDescription) System.Web.Services.Description.ServiceDescription.Serializer.Deserialize (Reader);
  153. return ob;
  154. }
  155. protected override void InitCallbacks ()
  156. {
  157. }
  158. protected override void InitIDs ()
  159. {
  160. }
  161. }
  162. internal class MetadataSectionWriterBase : XmlSerializationWriter
  163. {
  164. const string xmlNamespace = "http://www.w3.org/2000/xmlns/";
  165. public void WriteRoot_MetadataSection (object o)
  166. {
  167. WriteStartDocument ();
  168. System.ServiceModel.Description.MetadataSection ob = (System.ServiceModel.Description.MetadataSection) o;
  169. TopLevelElement ();
  170. WriteObject_MetadataSection (ob, "MetadataSection", "http://schemas.xmlsoap.org/ws/2004/09/mex", true, false, true);
  171. }
  172. void WriteObject_MetadataSection (System.ServiceModel.Description.MetadataSection ob, string element, string namesp, bool isNullable, bool needType, bool writeWrappingElem)
  173. {
  174. if (((object)ob) == null)
  175. {
  176. if (isNullable)
  177. WriteNullTagLiteral(element, namesp);
  178. return;
  179. }
  180. System.Type type = ob.GetType ();
  181. if (type == typeof(System.ServiceModel.Description.MetadataSection))
  182. { }
  183. else {
  184. throw CreateUnknownTypeException (ob);
  185. }
  186. if (writeWrappingElem) {
  187. WriteStartElement (element, namesp, ob);
  188. }
  189. if (needType) WriteXsiType("MetadataSection", "http://schemas.xmlsoap.org/ws/2004/09/mex");
  190. ICollection o2 = ob.@Attributes;
  191. if (o2 != null) {
  192. foreach (XmlAttribute o3 in o2)
  193. if (o3.NamespaceURI != xmlNamespace)
  194. WriteXmlAttribute (o3, ob);
  195. }
  196. WriteAttribute ("Dialect", "", ob.@Dialect);
  197. WriteAttribute ("Identifier", "", ob.@Identifier);
  198. if (ob.@Metadata is System.ServiceModel.Description.MetadataReference) {
  199. WriteSerializable (((System.ServiceModel.Description.MetadataReference) ob.@Metadata), "MetadataReference", "http://schemas.xmlsoap.org/ws/2004/09/mex", false);
  200. }
  201. else if (ob.@Metadata is System.Web.Services.Description.ServiceDescription) {
  202. WriteObject_ServiceDescription (((System.Web.Services.Description.ServiceDescription) ob.@Metadata), "definitions", "http://schemas.xmlsoap.org/wsdl/", false, false, true);
  203. }
  204. else if (ob.@Metadata is System.Xml.Schema.XmlSchema) {
  205. WriteObject_XmlSchema (((System.Xml.Schema.XmlSchema) ob.@Metadata), "schema", "http://www.w3.org/2001/XMLSchema", false, false, true);
  206. }
  207. else if (ob.@Metadata is System.ServiceModel.Description.MetadataSet) {
  208. WriteSerializable (((System.ServiceModel.Description.MetadataSet) ob.@Metadata), "Metadata", "http://schemas.xmlsoap.org/ws/2004/09/mex", false);
  209. }
  210. else if (ob.@Metadata is System.ServiceModel.Description.MetadataLocation) {
  211. WriteObject_MetadataLocation (((System.ServiceModel.Description.MetadataLocation) ob.@Metadata), "Location", "http://schemas.xmlsoap.org/ws/2004/09/mex", false, false, true);
  212. }
  213. else if (ob.@Metadata is System.Xml.XmlElement) {
  214. WriteElementLiteral (((System.Xml.XmlElement) ob.@Metadata), "", "http://schemas.xmlsoap.org/ws/2004/09/mex", false, false);
  215. }
  216. if (writeWrappingElem) WriteEndElement (ob);
  217. }
  218. void WriteObject_ServiceDescription (System.Web.Services.Description.ServiceDescription ob, string element, string namesp, bool isNullable, bool needType, bool writeWrappingElem)
  219. {
  220. System.Web.Services.Description.ServiceDescription.Serializer.Serialize (Writer, ob);
  221. }
  222. void WriteObject_XmlSchema (System.Xml.Schema.XmlSchema ob, string element, string namesp, bool isNullable, bool needType, bool writeWrappingElem)
  223. {
  224. ob.Write (Writer);
  225. }
  226. void WriteObject_MetadataLocation (System.ServiceModel.Description.MetadataLocation ob, string element, string namesp, bool isNullable, bool needType, bool writeWrappingElem)
  227. {
  228. if (((object)ob) == null)
  229. {
  230. if (isNullable)
  231. WriteNullTagLiteral(element, namesp);
  232. return;
  233. }
  234. System.Type type = ob.GetType ();
  235. if (type == typeof(System.ServiceModel.Description.MetadataLocation))
  236. { }
  237. else {
  238. throw CreateUnknownTypeException (ob);
  239. }
  240. if (writeWrappingElem) {
  241. WriteStartElement (element, namesp, ob);
  242. }
  243. if (needType) WriteXsiType("MetadataLocation", "http://schemas.xmlsoap.org/ws/2004/09/mex");
  244. WriteValue (ob.@Location);
  245. if (writeWrappingElem) WriteEndElement (ob);
  246. }
  247. void WriteObject_Import (System.Web.Services.Description.Import ob, string element, string namesp, bool isNullable, bool needType, bool writeWrappingElem)
  248. {
  249. if (((object)ob) == null)
  250. {
  251. if (isNullable)
  252. WriteNullTagLiteral(element, namesp);
  253. return;
  254. }
  255. System.Type type = ob.GetType ();
  256. if (type == typeof(System.Web.Services.Description.Import))
  257. { }
  258. else {
  259. throw CreateUnknownTypeException (ob);
  260. }
  261. if (writeWrappingElem) {
  262. WriteStartElement (element, namesp, ob);
  263. }
  264. if (needType) WriteXsiType("Import", "http://schemas.xmlsoap.org/wsdl/");
  265. ICollection o12 = ob.@ExtensibleAttributes;
  266. if (o12 != null) {
  267. foreach (XmlAttribute o13 in o12)
  268. if (o13.NamespaceURI != xmlNamespace)
  269. WriteXmlAttribute (o13, ob);
  270. }
  271. WriteAttribute ("location", "", ob.@Location);
  272. WriteAttribute ("namespace", "", ob.@Namespace);
  273. if (ob.@DocumentationElement != null) {
  274. XmlNode o14 = ob.@DocumentationElement;
  275. if (o14 is XmlElement) {
  276. if ((o14.Name == "documentation" && o14.NamespaceURI == "http://schemas.xmlsoap.org/wsdl/")) {
  277. }
  278. else o14.WriteTo (Writer);
  279. WriteElementLiteral (o14, "", "", false, true);
  280. }
  281. else
  282. throw CreateUnknownAnyElementException (o14.Name, o14.NamespaceURI);
  283. }
  284. if (writeWrappingElem) WriteEndElement (ob);
  285. }
  286. void WriteObject_Types (System.Web.Services.Description.Types ob, string element, string namesp, bool isNullable, bool needType, bool writeWrappingElem)
  287. {
  288. if (((object)ob) == null)
  289. {
  290. if (isNullable)
  291. WriteNullTagLiteral(element, namesp);
  292. return;
  293. }
  294. System.Type type = ob.GetType ();
  295. if (type == typeof(System.Web.Services.Description.Types))
  296. { }
  297. else {
  298. throw CreateUnknownTypeException (ob);
  299. }
  300. if (writeWrappingElem) {
  301. WriteStartElement (element, namesp, ob);
  302. }
  303. if (needType) WriteXsiType("Types", "http://schemas.xmlsoap.org/wsdl/");
  304. ICollection o15 = ob.@ExtensibleAttributes;
  305. if (o15 != null) {
  306. foreach (XmlAttribute o16 in o15)
  307. if (o16.NamespaceURI != xmlNamespace)
  308. WriteXmlAttribute (o16, ob);
  309. }
  310. if (ob.@DocumentationElement != null) {
  311. XmlNode o17 = ob.@DocumentationElement;
  312. if (o17 is XmlElement) {
  313. if ((o17.Name == "documentation" && o17.NamespaceURI == "http://schemas.xmlsoap.org/wsdl/")) {
  314. }
  315. else o17.WriteTo (Writer);
  316. WriteElementLiteral (o17, "", "", false, true);
  317. }
  318. else
  319. throw CreateUnknownAnyElementException (o17.Name, o17.NamespaceURI);
  320. }
  321. if (ob.@Schemas != null) {
  322. for (int n18 = 0; n18 < [email protected]; n18++) {
  323. WriteObject_XmlSchema (ob.@Schemas[n18], "schema", "http://www.w3.org/2001/XMLSchema", false, false, true);
  324. }
  325. }
  326. if (writeWrappingElem) WriteEndElement (ob);
  327. }
  328. void WriteObject_Message (System.Web.Services.Description.Message ob, string element, string namesp, bool isNullable, bool needType, bool writeWrappingElem)
  329. {
  330. if (((object)ob) == null)
  331. {
  332. if (isNullable)
  333. WriteNullTagLiteral(element, namesp);
  334. return;
  335. }
  336. System.Type type = ob.GetType ();
  337. if (type == typeof(System.Web.Services.Description.Message))
  338. { }
  339. else {
  340. throw CreateUnknownTypeException (ob);
  341. }
  342. if (writeWrappingElem) {
  343. WriteStartElement (element, namesp, ob);
  344. }
  345. if (needType) WriteXsiType("Message", "http://schemas.xmlsoap.org/wsdl/");
  346. ICollection o19 = ob.@ExtensibleAttributes;
  347. if (o19 != null) {
  348. foreach (XmlAttribute o20 in o19)
  349. if (o20.NamespaceURI != xmlNamespace)
  350. WriteXmlAttribute (o20, ob);
  351. }
  352. WriteAttribute ("name", "", ob.@Name);
  353. if (ob.@DocumentationElement != null) {
  354. XmlNode o21 = ob.@DocumentationElement;
  355. if (o21 is XmlElement) {
  356. if ((o21.Name == "documentation" && o21.NamespaceURI == "http://schemas.xmlsoap.org/wsdl/")) {
  357. }
  358. else o21.WriteTo (Writer);
  359. WriteElementLiteral (o21, "", "", false, true);
  360. }
  361. else
  362. throw CreateUnknownAnyElementException (o21.Name, o21.NamespaceURI);
  363. }
  364. if (ob.@Parts != null) {
  365. for (int n22 = 0; n22 < [email protected]; n22++) {
  366. WriteObject_MessagePart (ob.@Parts[n22], "part", "http://schemas.xmlsoap.org/wsdl/", false, false, true);
  367. }
  368. }
  369. if (writeWrappingElem) WriteEndElement (ob);
  370. }
  371. void WriteObject_PortType (System.Web.Services.Description.PortType ob, string element, string namesp, bool isNullable, bool needType, bool writeWrappingElem)
  372. {
  373. if (((object)ob) == null)
  374. {
  375. if (isNullable)
  376. WriteNullTagLiteral(element, namesp);
  377. return;
  378. }
  379. System.Type type = ob.GetType ();
  380. if (type == typeof(System.Web.Services.Description.PortType))
  381. { }
  382. else {
  383. throw CreateUnknownTypeException (ob);
  384. }
  385. if (writeWrappingElem) {
  386. WriteStartElement (element, namesp, ob);
  387. }
  388. if (needType) WriteXsiType("PortType", "http://schemas.xmlsoap.org/wsdl/");
  389. ICollection o23 = ob.@ExtensibleAttributes;
  390. if (o23 != null) {
  391. foreach (XmlAttribute o24 in o23)
  392. if (o24.NamespaceURI != xmlNamespace)
  393. WriteXmlAttribute (o24, ob);
  394. }
  395. WriteAttribute ("name", "", ob.@Name);
  396. if (ob.@DocumentationElement != null) {
  397. XmlNode o25 = ob.@DocumentationElement;
  398. if (o25 is XmlElement) {
  399. if ((o25.Name == "documentation" && o25.NamespaceURI == "http://schemas.xmlsoap.org/wsdl/")) {
  400. }
  401. else o25.WriteTo (Writer);
  402. WriteElementLiteral (o25, "", "", false, true);
  403. }
  404. else
  405. throw CreateUnknownAnyElementException (o25.Name, o25.NamespaceURI);
  406. }
  407. if (ob.@Operations != null) {
  408. for (int n26 = 0; n26 < [email protected]; n26++) {
  409. WriteObject_Operation (ob.@Operations[n26], "operation", "http://schemas.xmlsoap.org/wsdl/", false, false, true);
  410. }
  411. }
  412. if (writeWrappingElem) WriteEndElement (ob);
  413. }
  414. void WriteObject_Binding (System.Web.Services.Description.Binding ob, string element, string namesp, bool isNullable, bool needType, bool writeWrappingElem)
  415. {
  416. if (((object)ob) == null)
  417. {
  418. if (isNullable)
  419. WriteNullTagLiteral(element, namesp);
  420. return;
  421. }
  422. System.Type type = ob.GetType ();
  423. if (type == typeof(System.Web.Services.Description.Binding))
  424. { }
  425. else {
  426. throw CreateUnknownTypeException (ob);
  427. }
  428. if (writeWrappingElem) {
  429. WriteStartElement (element, namesp, ob);
  430. }
  431. if (needType) WriteXsiType("Binding", "http://schemas.xmlsoap.org/wsdl/");
  432. ICollection o27 = ob.@ExtensibleAttributes;
  433. if (o27 != null) {
  434. foreach (XmlAttribute o28 in o27)
  435. if (o28.NamespaceURI != xmlNamespace)
  436. WriteXmlAttribute (o28, ob);
  437. }
  438. WriteAttribute ("name", "", ob.@Name);
  439. WriteAttribute ("type", "", FromXmlQualifiedName (ob.@Type));
  440. if (ob.@DocumentationElement != null) {
  441. XmlNode o29 = ob.@DocumentationElement;
  442. if (o29 is XmlElement) {
  443. if ((o29.Name == "documentation" && o29.NamespaceURI == "http://schemas.xmlsoap.org/wsdl/")) {
  444. }
  445. else o29.WriteTo (Writer);
  446. WriteElementLiteral (o29, "", "", false, true);
  447. }
  448. else
  449. throw CreateUnknownAnyElementException (o29.Name, o29.NamespaceURI);
  450. }
  451. if (ob.@Operations != null) {
  452. for (int n30 = 0; n30 < [email protected]; n30++) {
  453. WriteObject_OperationBinding (ob.@Operations[n30], "operation", "http://schemas.xmlsoap.org/wsdl/", false, false, true);
  454. }
  455. }
  456. if (writeWrappingElem) WriteEndElement (ob);
  457. }
  458. void WriteObject_Service (System.Web.Services.Description.Service ob, string element, string namesp, bool isNullable, bool needType, bool writeWrappingElem)
  459. {
  460. if (((object)ob) == null)
  461. {
  462. if (isNullable)
  463. WriteNullTagLiteral(element, namesp);
  464. return;
  465. }
  466. System.Type type = ob.GetType ();
  467. if (type == typeof(System.Web.Services.Description.Service))
  468. { }
  469. else {
  470. throw CreateUnknownTypeException (ob);
  471. }
  472. if (writeWrappingElem) {
  473. WriteStartElement (element, namesp, ob);
  474. }
  475. if (needType) WriteXsiType("Service", "http://schemas.xmlsoap.org/wsdl/");
  476. ICollection o31 = ob.@ExtensibleAttributes;
  477. if (o31 != null) {
  478. foreach (XmlAttribute o32 in o31)
  479. if (o32.NamespaceURI != xmlNamespace)
  480. WriteXmlAttribute (o32, ob);
  481. }
  482. WriteAttribute ("name", "", ob.@Name);
  483. if (ob.@DocumentationElement != null) {
  484. XmlNode o33 = ob.@DocumentationElement;
  485. if (o33 is XmlElement) {
  486. if ((o33.Name == "documentation" && o33.NamespaceURI == "http://schemas.xmlsoap.org/wsdl/")) {
  487. }
  488. else o33.WriteTo (Writer);
  489. WriteElementLiteral (o33, "", "", false, true);
  490. }
  491. else
  492. throw CreateUnknownAnyElementException (o33.Name, o33.NamespaceURI);
  493. }
  494. if (ob.@Ports != null) {
  495. for (int n34 = 0; n34 < [email protected]; n34++) {
  496. WriteObject_Port (ob.@Ports[n34], "port", "http://schemas.xmlsoap.org/wsdl/", false, false, true);
  497. }
  498. }
  499. if (writeWrappingElem) WriteEndElement (ob);
  500. }
  501. void WriteObject_MessagePart (System.Web.Services.Description.MessagePart ob, string element, string namesp, bool isNullable, bool needType, bool writeWrappingElem)
  502. {
  503. if (((object)ob) == null)
  504. {
  505. if (isNullable)
  506. WriteNullTagLiteral(element, namesp);
  507. return;
  508. }
  509. System.Type type = ob.GetType ();
  510. if (type == typeof(System.Web.Services.Description.MessagePart))
  511. { }
  512. else {
  513. throw CreateUnknownTypeException (ob);
  514. }
  515. if (writeWrappingElem) {
  516. WriteStartElement (element, namesp, ob);
  517. }
  518. if (needType) WriteXsiType("MessagePart", "http://schemas.xmlsoap.org/wsdl/");
  519. ICollection o35 = ob.@ExtensibleAttributes;
  520. if (o35 != null) {
  521. foreach (XmlAttribute o36 in o35)
  522. if (o36.NamespaceURI != xmlNamespace)
  523. WriteXmlAttribute (o36, ob);
  524. }
  525. WriteAttribute ("name", "", ob.@Name);
  526. WriteAttribute ("element", "", FromXmlQualifiedName (ob.@Element));
  527. WriteAttribute ("type", "", FromXmlQualifiedName (ob.@Type));
  528. if (ob.@DocumentationElement != null) {
  529. XmlNode o37 = ob.@DocumentationElement;
  530. if (o37 is XmlElement) {
  531. if ((o37.Name == "documentation" && o37.NamespaceURI == "http://schemas.xmlsoap.org/wsdl/")) {
  532. }
  533. else o37.WriteTo (Writer);
  534. WriteElementLiteral (o37, "", "", false, true);
  535. }
  536. else
  537. throw CreateUnknownAnyElementException (o37.Name, o37.NamespaceURI);
  538. }
  539. if (writeWrappingElem) WriteEndElement (ob);
  540. }
  541. void WriteObject_Operation (System.Web.Services.Description.Operation ob, string element, string namesp, bool isNullable, bool needType, bool writeWrappingElem)
  542. {
  543. if (((object)ob) == null)
  544. {
  545. if (isNullable)
  546. WriteNullTagLiteral(element, namesp);
  547. return;
  548. }
  549. System.Type type = ob.GetType ();
  550. if (type == typeof(System.Web.Services.Description.Operation))
  551. { }
  552. else {
  553. throw CreateUnknownTypeException (ob);
  554. }
  555. if (writeWrappingElem) {
  556. WriteStartElement (element, namesp, ob);
  557. }
  558. if (needType) WriteXsiType("Operation", "http://schemas.xmlsoap.org/wsdl/");
  559. ICollection o38 = ob.@ExtensibleAttributes;
  560. if (o38 != null) {
  561. foreach (XmlAttribute o39 in o38)
  562. if (o39.NamespaceURI != xmlNamespace)
  563. WriteXmlAttribute (o39, ob);
  564. }
  565. WriteAttribute ("name", "", ob.@Name);
  566. if (ob.@ParameterOrderString != "") {
  567. WriteAttribute ("parameterOrder", "", ob.@ParameterOrderString);
  568. }
  569. if (ob.@DocumentationElement != null) {
  570. XmlNode o40 = ob.@DocumentationElement;
  571. if (o40 is XmlElement) {
  572. if ((o40.Name == "documentation" && o40.NamespaceURI == "http://schemas.xmlsoap.org/wsdl/")) {
  573. }
  574. else o40.WriteTo (Writer);
  575. WriteElementLiteral (o40, "", "", false, true);
  576. }
  577. else
  578. throw CreateUnknownAnyElementException (o40.Name, o40.NamespaceURI);
  579. }
  580. if (ob.@Faults != null) {
  581. for (int n41 = 0; n41 < [email protected]; n41++) {
  582. WriteObject_OperationFault (ob.@Faults[n41], "fault", "http://schemas.xmlsoap.org/wsdl/", false, false, true);
  583. }
  584. }
  585. if (ob.@Messages != null) {
  586. for (int n42 = 0; n42 < [email protected]; n42++) {
  587. if (((object)ob.@Messages[n42]) == null) { }
  588. else if (ob.@Messages[n42].GetType() == typeof(System.Web.Services.Description.OperationInput)) {
  589. WriteObject_OperationInput (((System.Web.Services.Description.OperationInput) ob.@Messages[n42]), "input", "http://schemas.xmlsoap.org/wsdl/", false, false, true);
  590. }
  591. else if (ob.@Messages[n42].GetType() == typeof(System.Web.Services.Description.OperationOutput)) {
  592. WriteObject_OperationOutput (((System.Web.Services.Description.OperationOutput) ob.@Messages[n42]), "output", "http://schemas.xmlsoap.org/wsdl/", false, false, true);
  593. }
  594. else throw CreateUnknownTypeException (ob.@Messages[n42]);
  595. }
  596. }
  597. if (writeWrappingElem) WriteEndElement (ob);
  598. }
  599. void WriteObject_OperationBinding (System.Web.Services.Description.OperationBinding ob, string element, string namesp, bool isNullable, bool needType, bool writeWrappingElem)
  600. {
  601. if (((object)ob) == null)
  602. {
  603. if (isNullable)
  604. WriteNullTagLiteral(element, namesp);
  605. return;
  606. }
  607. System.Type type = ob.GetType ();
  608. if (type == typeof(System.Web.Services.Description.OperationBinding))
  609. { }
  610. else {
  611. throw CreateUnknownTypeException (ob);
  612. }
  613. if (writeWrappingElem) {
  614. WriteStartElement (element, namesp, ob);
  615. }
  616. if (needType) WriteXsiType("OperationBinding", "http://schemas.xmlsoap.org/wsdl/");
  617. ICollection o43 = ob.@ExtensibleAttributes;
  618. if (o43 != null) {
  619. foreach (XmlAttribute o44 in o43)
  620. if (o44.NamespaceURI != xmlNamespace)
  621. WriteXmlAttribute (o44, ob);
  622. }
  623. WriteAttribute ("name", "", ob.@Name);
  624. if (ob.@DocumentationElement != null) {
  625. XmlNode o45 = ob.@DocumentationElement;
  626. if (o45 is XmlElement) {
  627. if ((o45.Name == "documentation" && o45.NamespaceURI == "http://schemas.xmlsoap.org/wsdl/")) {
  628. }
  629. else o45.WriteTo (Writer);
  630. WriteElementLiteral (o45, "", "", false, true);
  631. }
  632. else
  633. throw CreateUnknownAnyElementException (o45.Name, o45.NamespaceURI);
  634. }
  635. if (ob.@Faults != null) {
  636. for (int n46 = 0; n46 < [email protected]; n46++) {
  637. WriteObject_FaultBinding (ob.@Faults[n46], "fault", "http://schemas.xmlsoap.org/wsdl/", false, false, true);
  638. }
  639. }
  640. WriteObject_InputBinding (ob.@Input, "input", "http://schemas.xmlsoap.org/wsdl/", false, false, true);
  641. WriteObject_OutputBinding (ob.@Output, "output", "http://schemas.xmlsoap.org/wsdl/", false, false, true);
  642. if (writeWrappingElem) WriteEndElement (ob);
  643. }
  644. void WriteObject_Port (System.Web.Services.Description.Port ob, string element, string namesp, bool isNullable, bool needType, bool writeWrappingElem)
  645. {
  646. if (((object)ob) == null)
  647. {
  648. if (isNullable)
  649. WriteNullTagLiteral(element, namesp);
  650. return;
  651. }
  652. System.Type type = ob.GetType ();
  653. if (type == typeof(System.Web.Services.Description.Port))
  654. { }
  655. else {
  656. throw CreateUnknownTypeException (ob);
  657. }
  658. if (writeWrappingElem) {
  659. WriteStartElement (element, namesp, ob);
  660. }
  661. if (needType) WriteXsiType("Port", "http://schemas.xmlsoap.org/wsdl/");
  662. ICollection o47 = ob.@ExtensibleAttributes;
  663. if (o47 != null) {
  664. foreach (XmlAttribute o48 in o47)
  665. if (o48.NamespaceURI != xmlNamespace)
  666. WriteXmlAttribute (o48, ob);
  667. }
  668. WriteAttribute ("name", "", ob.@Name);
  669. WriteAttribute ("binding", "", FromXmlQualifiedName (ob.@Binding));
  670. if (ob.@DocumentationElement != null) {
  671. XmlNode o49 = ob.@DocumentationElement;
  672. if (o49 is XmlElement) {
  673. if ((o49.Name == "documentation" && o49.NamespaceURI == "http://schemas.xmlsoap.org/wsdl/")) {
  674. }
  675. else o49.WriteTo (Writer);
  676. WriteElementLiteral (o49, "", "", false, true);
  677. }
  678. else
  679. throw CreateUnknownAnyElementException (o49.Name, o49.NamespaceURI);
  680. }
  681. if (writeWrappingElem) WriteEndElement (ob);
  682. }
  683. void WriteObject_OperationFault (System.Web.Services.Description.OperationFault ob, string element, string namesp, bool isNullable, bool needType, bool writeWrappingElem)
  684. {
  685. if (((object)ob) == null)
  686. {
  687. if (isNullable)
  688. WriteNullTagLiteral(element, namesp);
  689. return;
  690. }
  691. System.Type type = ob.GetType ();
  692. if (type == typeof(System.Web.Services.Description.OperationFault))
  693. { }
  694. else {
  695. throw CreateUnknownTypeException (ob);
  696. }
  697. if (writeWrappingElem) {
  698. WriteStartElement (element, namesp, ob);
  699. }
  700. if (needType) WriteXsiType("OperationFault", "http://schemas.xmlsoap.org/wsdl/");
  701. ICollection o50 = ob.@ExtensibleAttributes;
  702. if (o50 != null) {
  703. foreach (XmlAttribute o51 in o50)
  704. if (o51.NamespaceURI != xmlNamespace)
  705. WriteXmlAttribute (o51, ob);
  706. }
  707. WriteAttribute ("name", "", ob.@Name);
  708. WriteAttribute ("message", "", FromXmlQualifiedName (ob.@Message));
  709. if (ob.@DocumentationElement != null) {
  710. XmlNode o52 = ob.@DocumentationElement;
  711. if (o52 is XmlElement) {
  712. if ((o52.Name == "documentation" && o52.NamespaceURI == "http://schemas.xmlsoap.org/wsdl/")) {
  713. }
  714. else o52.WriteTo (Writer);
  715. WriteElementLiteral (o52, "", "", false, true);
  716. }
  717. else
  718. throw CreateUnknownAnyElementException (o52.Name, o52.NamespaceURI);
  719. }
  720. if (writeWrappingElem) WriteEndElement (ob);
  721. }
  722. void WriteObject_OperationInput (System.Web.Services.Description.OperationInput ob, string element, string namesp, bool isNullable, bool needType, bool writeWrappingElem)
  723. {
  724. if (((object)ob) == null)
  725. {
  726. if (isNullable)
  727. WriteNullTagLiteral(element, namesp);
  728. return;
  729. }
  730. System.Type type = ob.GetType ();
  731. if (type == typeof(System.Web.Services.Description.OperationInput))
  732. { }
  733. else {
  734. throw CreateUnknownTypeException (ob);
  735. }
  736. if (writeWrappingElem) {
  737. WriteStartElement (element, namesp, ob);
  738. }
  739. if (needType) WriteXsiType("OperationInput", "http://schemas.xmlsoap.org/wsdl/");
  740. ICollection o53 = ob.@ExtensibleAttributes;
  741. if (o53 != null) {
  742. foreach (XmlAttribute o54 in o53)
  743. if (o54.NamespaceURI != xmlNamespace)
  744. WriteXmlAttribute (o54, ob);
  745. }
  746. WriteAttribute ("name", "", ob.@Name);
  747. WriteAttribute ("message", "", FromXmlQualifiedName (ob.@Message));
  748. if (ob.@DocumentationElement != null) {
  749. XmlNode o55 = ob.@DocumentationElement;
  750. if (o55 is XmlElement) {
  751. if ((o55.Name == "documentation" && o55.NamespaceURI == "http://schemas.xmlsoap.org/wsdl/")) {
  752. }
  753. else o55.WriteTo (Writer);
  754. WriteElementLiteral (o55, "", "", false, true);
  755. }
  756. else
  757. throw CreateUnknownAnyElementException (o55.Name, o55.NamespaceURI);
  758. }
  759. if (writeWrappingElem) WriteEndElement (ob);
  760. }
  761. void WriteObject_OperationOutput (System.Web.Services.Description.OperationOutput ob, string element, string namesp, bool isNullable, bool needType, bool writeWrappingElem)
  762. {
  763. if (((object)ob) == null)
  764. {
  765. if (isNullable)
  766. WriteNullTagLiteral(element, namesp);
  767. return;
  768. }
  769. System.Type type = ob.GetType ();
  770. if (type == typeof(System.Web.Services.Description.OperationOutput))
  771. { }
  772. else {
  773. throw CreateUnknownTypeException (ob);
  774. }
  775. if (writeWrappingElem) {
  776. WriteStartElement (element, namesp, ob);
  777. }
  778. if (needType) WriteXsiType("OperationOutput", "http://schemas.xmlsoap.org/wsdl/");
  779. ICollection o56 = ob.@ExtensibleAttributes;
  780. if (o56 != null) {
  781. foreach (XmlAttribute o57 in o56)
  782. if (o57.NamespaceURI != xmlNamespace)
  783. WriteXmlAttribute (o57, ob);
  784. }
  785. WriteAttribute ("name", "", ob.@Name);
  786. WriteAttribute ("message", "", FromXmlQualifiedName (ob.@Message));
  787. if (ob.@DocumentationElement != null) {
  788. XmlNode o58 = ob.@DocumentationElement;
  789. if (o58 is XmlElement) {
  790. if ((o58.Name == "documentation" && o58.NamespaceURI == "http://schemas.xmlsoap.org/wsdl/")) {
  791. }
  792. else o58.WriteTo (Writer);
  793. WriteElementLiteral (o58, "", "", false, true);
  794. }
  795. else
  796. throw CreateUnknownAnyElementException (o58.Name, o58.NamespaceURI);
  797. }
  798. if (writeWrappingElem) WriteEndElement (ob);
  799. }
  800. void WriteObject_FaultBinding (System.Web.Services.Description.FaultBinding ob, string element, string namesp, bool isNullable, bool needType, bool writeWrappingElem)
  801. {
  802. if (((object)ob) == null)
  803. {
  804. if (isNullable)
  805. WriteNullTagLiteral(element, namesp);
  806. return;
  807. }
  808. System.Type type = ob.GetType ();
  809. if (type == typeof(System.Web.Services.Description.FaultBinding))
  810. { }
  811. else {
  812. throw CreateUnknownTypeException (ob);
  813. }
  814. if (writeWrappingElem) {
  815. WriteStartElement (element, namesp, ob);
  816. }
  817. if (needType) WriteXsiType("FaultBinding", "http://schemas.xmlsoap.org/wsdl/");
  818. ICollection o59 = ob.@ExtensibleAttributes;
  819. if (o59 != null) {
  820. foreach (XmlAttribute o60 in o59)
  821. if (o60.NamespaceURI != xmlNamespace)
  822. WriteXmlAttribute (o60, ob);
  823. }
  824. WriteAttribute ("name", "", ob.@Name);
  825. if (ob.@DocumentationElement != null) {
  826. XmlNode o61 = ob.@DocumentationElement;
  827. if (o61 is XmlElement) {
  828. if ((o61.Name == "documentation" && o61.NamespaceURI == "http://schemas.xmlsoap.org/wsdl/")) {
  829. }
  830. else o61.WriteTo (Writer);
  831. WriteElementLiteral (o61, "", "", false, true);
  832. }
  833. else
  834. throw CreateUnknownAnyElementException (o61.Name, o61.NamespaceURI);
  835. }
  836. if (writeWrappingElem) WriteEndElement (ob);
  837. }
  838. void WriteObject_InputBinding (System.Web.Services.Description.InputBinding ob, string element, string namesp, bool isNullable, bool needType, bool writeWrappingElem)
  839. {
  840. if (((object)ob) == null)
  841. {
  842. if (isNullable)
  843. WriteNullTagLiteral(element, namesp);
  844. return;
  845. }
  846. System.Type type = ob.GetType ();
  847. if (type == typeof(System.Web.Services.Description.InputBinding))
  848. { }
  849. else {
  850. throw CreateUnknownTypeException (ob);
  851. }
  852. if (writeWrappingElem) {
  853. WriteStartElement (element, namesp, ob);
  854. }
  855. if (needType) WriteXsiType("InputBinding", "http://schemas.xmlsoap.org/wsdl/");
  856. ICollection o62 = ob.@ExtensibleAttributes;
  857. if (o62 != null) {
  858. foreach (XmlAttribute o63 in o62)
  859. if (o63.NamespaceURI != xmlNamespace)
  860. WriteXmlAttribute (o63, ob);
  861. }
  862. WriteAttribute ("name", "", ob.@Name);
  863. if (ob.@DocumentationElement != null) {
  864. XmlNode o64 = ob.@DocumentationElement;
  865. if (o64 is XmlElement) {
  866. if ((o64.Name == "documentation" && o64.NamespaceURI == "http://schemas.xmlsoap.org/wsdl/")) {
  867. }
  868. else o64.WriteTo (Writer);
  869. WriteElementLiteral (o64, "", "", false, true);
  870. }
  871. else
  872. throw CreateUnknownAnyElementException (o64.Name, o64.NamespaceURI);
  873. }
  874. if (writeWrappingElem) WriteEndElement (ob);
  875. }
  876. void WriteObject_OutputBinding (System.Web.Services.Description.OutputBinding ob, string element, string namesp, bool isNullable, bool needType, bool writeWrappingElem)
  877. {
  878. if (((object)ob) == null)
  879. {
  880. if (isNullable)
  881. WriteNullTagLiteral(element, namesp);
  882. return;
  883. }
  884. System.Type type = ob.GetType ();
  885. if (type == typeof(System.Web.Services.Description.OutputBinding))
  886. { }
  887. else {
  888. throw CreateUnknownTypeException (ob);
  889. }
  890. if (writeWrappingElem) {
  891. WriteStartElement (element, namesp, ob);
  892. }
  893. if (needType) WriteXsiType("OutputBinding", "http://schemas.xmlsoap.org/wsdl/");
  894. ICollection o65 = ob.@ExtensibleAttributes;
  895. if (o65 != null) {
  896. foreach (XmlAttribute o66 in o65)
  897. if (o66.NamespaceURI != xmlNamespace)
  898. WriteXmlAttribute (o66, ob);
  899. }
  900. WriteAttribute ("name", "", ob.@Name);
  901. if (ob.@DocumentationElement != null) {
  902. XmlNode o67 = ob.@DocumentationElement;
  903. if (o67 is XmlElement) {
  904. if ((o67.Name == "documentation" && o67.NamespaceURI == "http://schemas.xmlsoap.org/wsdl/")) {
  905. }
  906. else o67.WriteTo (Writer);
  907. WriteElementLiteral (o67, "", "", false, true);
  908. }
  909. else
  910. throw CreateUnknownAnyElementException (o67.Name, o67.NamespaceURI);
  911. }
  912. if (writeWrappingElem) WriteEndElement (ob);
  913. }
  914. protected override void InitCallbacks ()
  915. {
  916. }
  917. }
  918. internal class BaseXmlSerializer : System.Xml.Serialization.XmlSerializer
  919. {
  920. protected override System.Xml.Serialization.XmlSerializationReader CreateReader () {
  921. return new MetadataSectionReaderBase ();
  922. }
  923. protected override System.Xml.Serialization.XmlSerializationWriter CreateWriter () {
  924. return new MetadataSectionWriterBase ();
  925. }
  926. public override bool CanDeserialize (System.Xml.XmlReader xmlReader) {
  927. return true;
  928. }
  929. }
  930. internal sealed class MetadataSectionSerializer : BaseXmlSerializer
  931. {
  932. protected override void Serialize (object obj, System.Xml.Serialization.XmlSerializationWriter writer) {
  933. ((MetadataSectionWriterBase)writer).WriteRoot_MetadataSection(obj);
  934. }
  935. protected override object Deserialize (System.Xml.Serialization.XmlSerializationReader reader) {
  936. return ((MetadataSectionReaderBase)reader).ReadRoot_MetadataSection();
  937. }
  938. }
  939. internal class XmlSerializerContract : System.Xml.Serialization.XmlSerializerImplementation
  940. {
  941. System.Collections.Hashtable readMethods = null;
  942. System.Collections.Hashtable writeMethods = null;
  943. System.Collections.Hashtable typedSerializers = null;
  944. public override System.Xml.Serialization.XmlSerializationReader Reader {
  945. get {
  946. return new MetadataSectionReaderBase();
  947. }
  948. }
  949. public override System.Xml.Serialization.XmlSerializationWriter Writer {
  950. get {
  951. return new MetadataSectionWriterBase();
  952. }
  953. }
  954. public override System.Collections.Hashtable ReadMethods {
  955. get {
  956. lock (this) {
  957. if (readMethods == null) {
  958. readMethods = new System.Collections.Hashtable ();
  959. readMethods.Add (@"", @"ReadRoot_MetadataSection");
  960. }
  961. return readMethods;
  962. }
  963. }
  964. }
  965. public override System.Collections.Hashtable WriteMethods {
  966. get {
  967. lock (this) {
  968. if (writeMethods == null) {
  969. writeMethods = new System.Collections.Hashtable ();
  970. writeMethods.Add (@"", @"WriteRoot_MetadataSection");
  971. }
  972. return writeMethods;
  973. }
  974. }
  975. }
  976. public override System.Collections.Hashtable TypedSerializers {
  977. get {
  978. lock (this) {
  979. if (typedSerializers == null) {
  980. typedSerializers = new System.Collections.Hashtable ();
  981. typedSerializers.Add (@"", new MetadataSectionSerializer());
  982. }
  983. return typedSerializers;
  984. }
  985. }
  986. }
  987. public override bool CanSerialize (System.Type type) {
  988. if (type == typeof(System.ServiceModel.Description.MetadataSection)) return true;
  989. return false;
  990. }
  991. }
  992. }