4 using System
.Xml
.Schema
;
5 using System
.Xml
.Serialization
;
7 using System
.Collections
;
8 using System
.Globalization
;
10 namespace System
.Web
.Services
.Protocols
12 internal class Soap12FaultReader
: XmlSerializationReader
14 public object ReadRoot_Soap12Fault ()
16 Reader
.MoveToContent();
17 if (Reader
.LocalName
!= "Fault" || Reader
.NamespaceURI
!= "http://www.w3.org/2003/05/soap-envelope")
18 throw CreateUnknownNodeException();
19 return ReadObject_Fault (true, true);
22 public System
.Web
.Services
.Protocols
.Soap12Fault
ReadObject_Fault (bool isNullable
, bool checkType
)
24 System
.Web
.Services
.Protocols
.Soap12Fault ob
= null;
25 if (isNullable
&& ReadNull()) return null;
29 System
.Xml
.XmlQualifiedName t
= GetXsiType();
32 else if (t
.Name
!= "Fault" || t
.Namespace
!= "http://www.w3.org/2003/05/soap-envelope")
33 throw CreateUnknownTypeException(t
);
36 ob
= new System
.Web
.Services
.Protocols
.Soap12Fault ();
38 Reader
.MoveToElement();
40 while (Reader
.MoveToNextAttribute())
42 if (IsXmlnsAttribute (Reader
.Name
)) {
49 Reader
.MoveToElement();
50 if (Reader
.IsEmptyElement
) {
55 Reader
.ReadStartElement();
56 Reader
.MoveToContent();
58 bool b0
=false, b1
=false, b2
=false, b3
=false, b4
=false;
60 while (Reader
.NodeType
!= System
.Xml
.XmlNodeType
.EndElement
)
62 if (Reader
.NodeType
== System
.Xml
.XmlNodeType
.Element
)
64 if (Reader
.LocalName
== "Role" && Reader
.NamespaceURI
== "http://www.w3.org/2003/05/soap-envelope" && !b3
) {
66 ob
.@Role
= Reader
.ReadElementString ();
68 else if (Reader
.LocalName
== "Detail" && Reader
.NamespaceURI
== "http://www.w3.org/2003/05/soap-envelope" && !b4
) {
70 ob
.@Detail
= ReadObject_Detail (false, true);
72 else if (Reader
.LocalName
== "Code" && Reader
.NamespaceURI
== "http://www.w3.org/2003/05/soap-envelope" && !b0
) {
74 ob
.@Code
= ReadObject_Code (false, true);
76 else if (Reader
.LocalName
== "Node" && Reader
.NamespaceURI
== "http://www.w3.org/2003/05/soap-envelope" && !b2
) {
78 ob
.@Node
= Reader
.ReadElementString ();
80 else if (Reader
.LocalName
== "Reason" && Reader
.NamespaceURI
== "http://www.w3.org/2003/05/soap-envelope" && !b1
) {
82 ob
.@Reason
= ReadObject_Reason (false, true);
91 Reader
.MoveToContent();
99 public System
.Web
.Services
.Protocols
.Soap12FaultDetail
ReadObject_Detail (bool isNullable
, bool checkType
)
101 System
.Web
.Services
.Protocols
.Soap12FaultDetail ob
= null;
102 if (isNullable
&& ReadNull()) return null;
106 System
.Xml
.XmlQualifiedName t
= GetXsiType();
109 else if (t
.Name
!= "Detail" || t
.Namespace
!= "http://www.w3.org/2003/05/soap-envelope")
110 throw CreateUnknownTypeException(t
);
113 ob
= new System
.Web
.Services
.Protocols
.Soap12FaultDetail ();
115 Reader
.MoveToElement();
117 int anyAttributeIndex
= 0;
118 System
.Xml
.XmlAttribute
[] anyAttributeArray
= null;
119 while (Reader
.MoveToNextAttribute())
121 if (IsXmlnsAttribute (Reader
.Name
)) {
124 System
.Xml
.XmlAttribute attr
= (System
.Xml
.XmlAttribute
) Document
.ReadNode(Reader
);
125 anyAttributeArray
= (System
.Xml
.XmlAttribute
[]) EnsureArrayIndex (anyAttributeArray
, anyAttributeIndex
, typeof(System
.Xml
.XmlAttribute
));
126 anyAttributeArray
[anyAttributeIndex
] = ((System
.Xml
.XmlAttribute
) attr
);
131 anyAttributeArray
= (System
.Xml
.XmlAttribute
[]) ShrinkArray (anyAttributeArray
, anyAttributeIndex
, typeof(System
.Xml
.XmlAttribute
), true);
132 ob
.@Attributes
= anyAttributeArray
;
134 Reader
.MoveToElement();
135 if (Reader
.IsEmptyElement
) {
140 Reader
.ReadStartElement();
141 Reader
.MoveToContent();
143 bool b5
=false, b6
=false;
145 System
.Xml
.XmlElement
[] o8
;
149 while (Reader
.NodeType
!= System
.Xml
.XmlNodeType
.EndElement
)
151 if (Reader
.NodeType
== System
.Xml
.XmlNodeType
.Element
)
153 o8
= (System
.Xml
.XmlElement
[]) EnsureArrayIndex (o8
, n7
, typeof(System
.Xml
.XmlElement
));
154 o8
[n7
] = ((System
.Xml
.XmlElement
) ReadXmlNode (false));
157 else if (Reader
.NodeType
== System
.Xml
.XmlNodeType
.Text
|| Reader
.NodeType
== System
.Xml
.XmlNodeType
.CDATA
)
159 ob
.@Text
= ReadString (ob
.@Text
);
164 Reader
.MoveToContent();
167 o8
= (System
.Xml
.XmlElement
[]) ShrinkArray (o8
, n7
, typeof(System
.Xml
.XmlElement
), true);
175 public System
.Web
.Services
.Protocols
.Soap12FaultCode
ReadObject_Code (bool isNullable
, bool checkType
)
177 System
.Web
.Services
.Protocols
.Soap12FaultCode ob
= null;
178 if (isNullable
&& ReadNull()) return null;
182 System
.Xml
.XmlQualifiedName t
= GetXsiType();
185 else if (t
.Name
!= "Code" || t
.Namespace
!= "http://www.w3.org/2003/05/soap-envelope")
186 throw CreateUnknownTypeException(t
);
189 ob
= new System
.Web
.Services
.Protocols
.Soap12FaultCode ();
191 Reader
.MoveToElement();
193 while (Reader
.MoveToNextAttribute())
195 if (IsXmlnsAttribute (Reader
.Name
)) {
202 Reader
.MoveToElement();
203 if (Reader
.IsEmptyElement
) {
208 Reader
.ReadStartElement();
209 Reader
.MoveToContent();
211 bool b9
=false, b10
=false;
213 while (Reader
.NodeType
!= System
.Xml
.XmlNodeType
.EndElement
)
215 if (Reader
.NodeType
== System
.Xml
.XmlNodeType
.Element
)
217 if (Reader
.LocalName
== "Value" && Reader
.NamespaceURI
== "http://www.w3.org/2003/05/soap-envelope" && !b9
) {
219 ob
.@Value
= ReadElementQualifiedName ();
221 else if (Reader
.LocalName
== "Subcode" && Reader
.NamespaceURI
== "http://www.w3.org/2003/05/soap-envelope" && !b10
) {
223 ob
.@Subcode
= ReadObject_Code (false, true);
232 Reader
.MoveToContent();
240 public System
.Web
.Services
.Protocols
.Soap12FaultReason
ReadObject_Reason (bool isNullable
, bool checkType
)
242 System
.Web
.Services
.Protocols
.Soap12FaultReason ob
= null;
243 if (isNullable
&& ReadNull()) return null;
247 System
.Xml
.XmlQualifiedName t
= GetXsiType();
250 else if (t
.Name
!= "Reason" || t
.Namespace
!= "http://www.w3.org/2003/05/soap-envelope")
251 throw CreateUnknownTypeException(t
);
254 ob
= new System
.Web
.Services
.Protocols
.Soap12FaultReason ();
256 Reader
.MoveToElement();
258 while (Reader
.MoveToNextAttribute())
260 if (IsXmlnsAttribute (Reader
.Name
)) {
267 Reader
.MoveToElement();
268 if (Reader
.IsEmptyElement
) {
273 Reader
.ReadStartElement();
274 Reader
.MoveToContent();
278 System
.Web
.Services
.Protocols
.Soap12FaultReasonText
[] o13
;
282 while (Reader
.NodeType
!= System
.Xml
.XmlNodeType
.EndElement
)
284 if (Reader
.NodeType
== System
.Xml
.XmlNodeType
.Element
)
286 if (Reader
.LocalName
== "Text" && Reader
.NamespaceURI
== "http://www.w3.org/2003/05/soap-envelope" && !b11
) {
287 o13
= (System
.Web
.Services
.Protocols
.Soap12FaultReasonText
[]) EnsureArrayIndex (o13
, n12
, typeof(System
.Web
.Services
.Protocols
.Soap12FaultReasonText
));
288 o13
[n12
] = ReadObject_Text (false, true);
298 Reader
.MoveToContent();
301 o13
= (System
.Web
.Services
.Protocols
.Soap12FaultReasonText
[]) ShrinkArray (o13
, n12
, typeof(System
.Web
.Services
.Protocols
.Soap12FaultReasonText
), true);
309 public System
.Web
.Services
.Protocols
.Soap12FaultReasonText
ReadObject_Text (bool isNullable
, bool checkType
)
311 System
.Web
.Services
.Protocols
.Soap12FaultReasonText ob
= null;
312 if (isNullable
&& ReadNull()) return null;
316 System
.Xml
.XmlQualifiedName t
= GetXsiType();
319 else if (t
.Name
!= "Text" || t
.Namespace
!= "http://www.w3.org/2003/05/soap-envelope")
320 throw CreateUnknownTypeException(t
);
323 ob
= new System
.Web
.Services
.Protocols
.Soap12FaultReasonText ();
325 Reader
.MoveToElement();
327 while (Reader
.MoveToNextAttribute())
329 if (Reader
.LocalName
== "lang" && Reader
.NamespaceURI
== "http://www.w3.org/XML/1998/namespace") {
330 ob
.@XmlLang
= Reader
.Value
;
332 else if (IsXmlnsAttribute (Reader
.Name
)) {
339 Reader
.MoveToElement();
340 if (Reader
.IsEmptyElement
) {
345 Reader
.ReadStartElement();
346 Reader
.MoveToContent();
350 while (Reader
.NodeType
!= System
.Xml
.XmlNodeType
.EndElement
)
352 if (Reader
.NodeType
== System
.Xml
.XmlNodeType
.Element
)
356 else if (Reader
.NodeType
== System
.Xml
.XmlNodeType
.Text
|| Reader
.NodeType
== System
.Xml
.XmlNodeType
.CDATA
)
358 ob
.@Value
= ReadString (ob
.@Value
);
363 Reader
.MoveToContent();
371 protected override void InitCallbacks ()
375 protected override void InitIDs ()
381 internal class Soap12FaultWriter
: XmlSerializationWriter
383 const string xmlNamespace
= "http://www.w3.org/2000/xmlns/";
384 public void WriteRoot_Soap12Fault (object o
)
386 WriteStartDocument ();
387 System
.Web
.Services
.Protocols
.Soap12Fault ob
= (System
.Web
.Services
.Protocols
.Soap12Fault
) o
;
389 WriteObject_Fault (ob
, "Fault", "http://www.w3.org/2003/05/soap-envelope", true, false, true);
392 void WriteObject_Fault (System
.Web
.Services
.Protocols
.Soap12Fault ob
, string element
, string namesp
, bool isNullable
, bool needType
, bool writeWrappingElem
)
394 if (((object)ob
) == null)
397 WriteNullTagLiteral(element
, namesp
);
401 System
.Type type
= ob
.GetType ();
402 if (type
== typeof(System
.Web
.Services
.Protocols
.Soap12Fault
))
405 throw CreateUnknownTypeException (ob
);
408 if (writeWrappingElem
) {
409 WriteStartElement (element
, namesp
, ob
);
412 if (needType
) WriteXsiType("Fault", "http://www.w3.org/2003/05/soap-envelope");
414 WriteObject_Code (ob
.@Code
, "Code", "http://www.w3.org/2003/05/soap-envelope", false, false, true);
415 WriteObject_Reason (ob
.@Reason
, "Reason", "http://www.w3.org/2003/05/soap-envelope", false, false, true);
416 WriteElementString ("Node", "http://www.w3.org/2003/05/soap-envelope", ((ob
.@Node
!= null) ? (ob
.@Node
).ToString() : null));
417 WriteElementString ("Role", "http://www.w3.org/2003/05/soap-envelope", ((ob
.@Role
!= null) ? (ob
.@Role
).ToString() : null));
418 WriteObject_Detail (ob
.@Detail
, "Detail", "http://www.w3.org/2003/05/soap-envelope", false, false, true);
419 if (writeWrappingElem
) WriteEndElement (ob
);
422 void WriteObject_Code (System
.Web
.Services
.Protocols
.Soap12FaultCode ob
, string element
, string namesp
, bool isNullable
, bool needType
, bool writeWrappingElem
)
424 if (((object)ob
) == null)
427 WriteNullTagLiteral(element
, namesp
);
431 System
.Type type
= ob
.GetType ();
432 if (type
== typeof(System
.Web
.Services
.Protocols
.Soap12FaultCode
))
435 throw CreateUnknownTypeException (ob
);
438 if (writeWrappingElem
) {
439 WriteStartElement (element
, namesp
, ob
);
442 if (needType
) WriteXsiType("Code", "http://www.w3.org/2003/05/soap-envelope");
444 WriteElementQualifiedName ("Value", "http://www.w3.org/2003/05/soap-envelope", ob
.@Value
);
445 WriteObject_Code (ob
.@Subcode
, "Subcode", "http://www.w3.org/2003/05/soap-envelope", false, false, true);
446 if (writeWrappingElem
) WriteEndElement (ob
);
449 void WriteObject_Reason (System
.Web
.Services
.Protocols
.Soap12FaultReason ob
, string element
, string namesp
, bool isNullable
, bool needType
, bool writeWrappingElem
)
451 if (((object)ob
) == null)
454 WriteNullTagLiteral(element
, namesp
);
458 System
.Type type
= ob
.GetType ();
459 if (type
== typeof(System
.Web
.Services
.Protocols
.Soap12FaultReason
))
462 throw CreateUnknownTypeException (ob
);
465 if (writeWrappingElem
) {
466 WriteStartElement (element
, namesp
, ob
);
469 if (needType
) WriteXsiType("Reason", "http://www.w3.org/2003/05/soap-envelope");
471 if (ob
.@Texts
!= null) {
472 for (int n15
= 0; n15
< ob
.@Texts
.Length
; n15
++) {
473 WriteObject_Text (ob
.@Texts
[n15
], "Text", "http://www.w3.org/2003/05/soap-envelope", false, false, true);
476 if (writeWrappingElem
) WriteEndElement (ob
);
479 void WriteObject_Detail (System
.Web
.Services
.Protocols
.Soap12FaultDetail ob
, string element
, string namesp
, bool isNullable
, bool needType
, bool writeWrappingElem
)
481 if (((object)ob
) == null)
484 WriteNullTagLiteral(element
, namesp
);
488 System
.Type type
= ob
.GetType ();
489 if (type
== typeof(System
.Web
.Services
.Protocols
.Soap12FaultDetail
))
492 throw CreateUnknownTypeException (ob
);
495 if (writeWrappingElem
) {
496 WriteStartElement (element
, namesp
, ob
);
499 if (needType
) WriteXsiType("Detail", "http://www.w3.org/2003/05/soap-envelope");
501 ICollection o16
= ob
.@Attributes
;
503 foreach (XmlAttribute o17
in o16
)
504 if (o17
.NamespaceURI
!= xmlNamespace
)
505 WriteXmlAttribute (o17
, ob
);
508 if (ob
.@Children
!= null) {
509 foreach (XmlNode o18
in ob
.@Children
) {
511 if (o19
is XmlElement
) {
513 else o19
.WriteTo (Writer
);
514 WriteElementLiteral (o19
, "", "", false, true);
517 WriteValue (ob
.@Text
);
518 if (writeWrappingElem
) WriteEndElement (ob
);
521 void WriteObject_Text (System
.Web
.Services
.Protocols
.Soap12FaultReasonText ob
, string element
, string namesp
, bool isNullable
, bool needType
, bool writeWrappingElem
)
523 if (((object)ob
) == null)
526 WriteNullTagLiteral(element
, namesp
);
530 System
.Type type
= ob
.GetType ();
531 if (type
== typeof(System
.Web
.Services
.Protocols
.Soap12FaultReasonText
))
534 throw CreateUnknownTypeException (ob
);
537 if (writeWrappingElem
) {
538 WriteStartElement (element
, namesp
, ob
);
541 if (needType
) WriteXsiType("Text", "http://www.w3.org/2003/05/soap-envelope");
543 WriteAttribute ("lang", "http://www.w3.org/XML/1998/namespace", ob
.@XmlLang
);
545 WriteValue (ob
.@Value
);
546 if (writeWrappingElem
) WriteEndElement (ob
);
549 protected override void InitCallbacks ()
556 internal class Soap12FaultBaseSerializer
: System
.Xml
.Serialization
.XmlSerializer
558 protected override System
.Xml
.Serialization
.XmlSerializationReader
CreateReader () {
559 return new Soap12FaultReader ();
562 protected override System
.Xml
.Serialization
.XmlSerializationWriter
CreateWriter () {
563 return new Soap12FaultWriter ();
566 public override bool CanDeserialize (System
.Xml
.XmlReader xmlReader
) {
571 internal sealed class Fault12Serializer
: Soap12FaultBaseSerializer
573 protected override void Serialize (object obj
, System
.Xml
.Serialization
.XmlSerializationWriter writer
) {
574 ((Soap12FaultWriter
)writer
).WriteRoot_Soap12Fault(obj
);
577 protected override object Deserialize (System
.Xml
.Serialization
.XmlSerializationReader reader
) {
578 return ((Soap12FaultReader
)reader
).ReadRoot_Soap12Fault();
582 internal class Soap12FaultSerializerImplementation
: System
.Xml
.Serialization
.XmlSerializerImplementation
584 System
.Collections
.Hashtable readMethods
= null;
585 System
.Collections
.Hashtable writeMethods
= null;
586 System
.Collections
.Hashtable typedSerializers
= null;
588 public override System
.Xml
.Serialization
.XmlSerializationReader Reader
{
590 return new Soap12FaultReader();
594 public override System
.Xml
.Serialization
.XmlSerializationWriter Writer
{
596 return new Soap12FaultWriter();
600 public override System
.Collections
.Hashtable ReadMethods
{
603 if (readMethods
== null) {
604 readMethods
= new System
.Collections
.Hashtable ();
605 readMethods
.Add (@"", @"ReadRoot_Soap12Fault");
612 public override System
.Collections
.Hashtable WriteMethods
{
615 if (writeMethods
== null) {
616 writeMethods
= new System
.Collections
.Hashtable ();
617 writeMethods
.Add (@"", @"WriteRoot_Soap12Fault");
624 public override System
.Collections
.Hashtable TypedSerializers
{
627 if (typedSerializers
== null) {
628 typedSerializers
= new System
.Collections
.Hashtable ();
629 typedSerializers
.Add (@"", new FaultSerializer());
631 return typedSerializers
;
636 public override XmlSerializer
GetSerializer (Type type
)
638 switch (type
.FullName
) {
639 case "System.Web.Services.Protocols.Soap12Fault":
640 return (XmlSerializer
) TypedSerializers
[""];
643 return base.GetSerializer (type
);
646 public override bool CanSerialize (System
.Type type
) {
647 if (type
== typeof(System
.Web
.Services
.Protocols
.Soap12Fault
)) return true;