Author: atsushi
Date: 2006-11-28 07:38:22 -0500 (Tue, 28 Nov 2006)
New Revision: 68575

Added:
   
branches/atsushi/mcs/class/System.Web.Services/System.Web.Services.Protocols/Fault12.cs
   
branches/atsushi/mcs/class/System.Web.Services/System.Web.Services.Protocols/Fault12Serializer.cs
   
branches/atsushi/mcs/class/System.Web.Services/System.Web.Services.Protocols/fault-12.genxs
Modified:
   branches/atsushi/mcs/class/System.Web.Services/ChangeLog
   
branches/atsushi/mcs/class/System.Web.Services/System.Web.Services.Protocols/ChangeLog
   
branches/atsushi/mcs/class/System.Web.Services/System.Web.Services.Protocols/HttpSoapWebServiceHandler.cs
   
branches/atsushi/mcs/class/System.Web.Services/System.Web.Services.Protocols/Methods.cs
   
branches/atsushi/mcs/class/System.Web.Services/System.Web.Services.Protocols/SoapException.cs
   
branches/atsushi/mcs/class/System.Web.Services/System.Web.Services.Protocols/SoapHttpClientProtocol.cs
   
branches/atsushi/mcs/class/System.Web.Services/System.Web.Services.Protocols/WebServiceHelper.cs
   
branches/atsushi/mcs/class/System.Web.Services/System.Web.Services.dll.sources
Log:
2006-11-28  Atsushi Enomoto  <[EMAIL PROTECTED]>

        * System.Web.Services.dll.sources : added SOAP 1.2 Fault serializer
          files (fault-12.genxs, Fault12.cs and Fault12Serializer.cs).

        * Fault12.cs, fault-12.genxs, Fault12Serializer.cs :
          SOAP 1.2 Fault serializer and its generation sources.
        * SoapException.cs :
          Fixed .ctor() whose initialization was incorrect.
        * WebServiceHelper.cs, Methods.cs, HttpSoapWebServiceHandler.cs,
          SoapHttpClientProtocol.cs :
          handle SOAP 1.2 Fault.



Modified: branches/atsushi/mcs/class/System.Web.Services/ChangeLog
===================================================================
--- branches/atsushi/mcs/class/System.Web.Services/ChangeLog    2006-11-28 
11:56:12 UTC (rev 68574)
+++ branches/atsushi/mcs/class/System.Web.Services/ChangeLog    2006-11-28 
12:38:22 UTC (rev 68575)
@@ -1,3 +1,8 @@
+2006-11-28  Atsushi Enomoto  <[EMAIL PROTECTED]>
+
+       * System.Web.Services.dll.sources : added SOAP 1.2 Fault serializer
+         files (fault-12.genxs, Fault12.cs and Fault12Serializer.cs).
+
 2006-11-16  Atsushi Enomoto  <[EMAIL PROTECTED]>
 
        * System.Web.Services.dll.sources : added/removed/replaced 2.0 server

Modified: 
branches/atsushi/mcs/class/System.Web.Services/System.Web.Services.Protocols/ChangeLog
===================================================================
--- 
branches/atsushi/mcs/class/System.Web.Services/System.Web.Services.Protocols/ChangeLog
      2006-11-28 11:56:12 UTC (rev 68574)
+++ 
branches/atsushi/mcs/class/System.Web.Services/System.Web.Services.Protocols/ChangeLog
      2006-11-28 12:38:22 UTC (rev 68575)
@@ -1,3 +1,13 @@
+2006-11-28  Atsushi Enomoto  <[EMAIL PROTECTED]>
+
+       * Fault12.cs, fault-12.genxs, Fault12Serializer.cs :
+         SOAP 1.2 Fault serializer and its generation sources.
+       * SoapException.cs :
+         Fixed .ctor() whose initialization was incorrect.
+       * WebServiceHelper.cs, Methods.cs, HttpSoapWebServiceHandler.cs,
+         SoapHttpClientProtocol.cs :
+         handle SOAP 1.2 Fault.
+
 2006-11-22  Atsushi Enomoto  <[EMAIL PROTECTED]>
 
        * SoapHeader.cs WebServiceHelper.cs SoapClientMessage.cs

Added: 
branches/atsushi/mcs/class/System.Web.Services/System.Web.Services.Protocols/Fault12.cs
===================================================================
--- 
branches/atsushi/mcs/class/System.Web.Services/System.Web.Services.Protocols/Fault12.cs
     2006-11-28 11:56:12 UTC (rev 68574)
+++ 
branches/atsushi/mcs/class/System.Web.Services/System.Web.Services.Protocols/Fault12.cs
     2006-11-28 12:38:22 UTC (rev 68575)
@@ -0,0 +1,166 @@
+// 
+// Fault12.cs
+//
+// Author:
+//     Atsushi Enomoto  <[EMAIL PROTECTED]>
+//
+// Copyright (C) 2006 Novell, Inc.
+//
+
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+//
+// This file is used to generate Fault12Serializer.cs with fault-12.genxs.
+// To generate the file, do:
+//     - replace _internal_ class in this file to _public_ class
+//     - optionally you might have to remove Fault12Serializer.cs from
+//       System.Web.Services.dll.sources.
+//     - Build System.Web.Services.dll with make PROFILE=net_2_0.
+//     - run genxs.exe with 2.0 libraries (the easiest way would be
+//       to build genxs under 2.0 profile i.e. make PROFILE=net_2_0)
+//     - Edit Fault12Serializer.cs to rename "FaultSerializer" to
+//       "Fault12Serializer" as the name is a duplicate, and
+//       wrap the entire code with #if NET_2_0.
+//     - revert _public_ class in this file to _internal_ class back.
+//
+
+using System;
+using System.Xml;
+using System.Xml.Schema;
+using System.Xml.Serialization;
+using System.Text;
+using System.Collections;
+using System.Globalization;
+
+namespace System.Web.Services.Protocols
+{
+       [XmlRoot ("Fault", Namespace = 
"http://www.w3.org/2003/05/soap-envelope";)]
+       [XmlType ("Fault", Namespace = 
"http://www.w3.org/2003/05/soap-envelope";)]
+       public class Soap12Fault
+       {
+               // dummy constructor to not be rejected by genxs.
+               public Soap12Fault ()
+               {
+               }
+
+               public static XmlSerializer Serializer =
+#if NET_2_0
+                       new Fault12Serializer ();
+#else
+                       null;
+#endif
+
+#if NET_2_0
+
+               public Soap12Fault (SoapException ex) 
+               {
+                       Code = new Soap12FaultCode ();
+                       Code.Value = ex.Code;
+                       Code.Subcode = CreateFaultCode (ex.SubCode);
+                       Node = ex.Node;
+                       Role = ex.Role;
+                       Reason = new Soap12FaultReason ();
+                       Soap12FaultReasonText text =
+                               new Soap12FaultReasonText ();
+                       text.XmlLang = ex.Lang;
+                       text.Value = ex.Message;
+                       Reason.Texts = new Soap12FaultReasonText [] {text};
+                       if (ex.Detail != null) {
+                               Detail = new Soap12FaultDetail ();
+                               if (ex.Detail.NodeType == XmlNodeType.Attribute)
+                                       Detail.Attributes = new XmlAttribute [] 
{
+                                               (XmlAttribute) ex.Detail};
+                               else if (ex.Detail.NodeType == 
XmlNodeType.Element)
+                                       Detail.Children = new XmlElement [] {
+                                               (XmlElement) ex.Detail};
+                               else
+                                       Detail.Text = ex.Detail.Value;
+                       }
+               }
+
+               static Soap12FaultCode CreateFaultCode (SoapFaultSubCode code)
+               {
+                       Soap12FaultCode ret = new Soap12FaultCode ();
+                       ret.Value = code.Code;
+                       if (code.SubCode != null)
+                               ret.Subcode = CreateFaultCode (code.SubCode);
+                       return ret;
+               }
+
+               public static SoapFaultSubCode GetSoapFaultSubCode 
(Soap12FaultCode src)
+               {
+                       return (src == null) ? null :
+                               new SoapFaultSubCode (src.Value, 
GetSoapFaultSubCode (src.Subcode));
+               }
+#endif
+
+               public Soap12FaultCode Code;
+
+               public Soap12FaultReason Reason;
+
+               [XmlElement (DataType = "anyURI")]
+               public string Node;
+
+               [XmlElement (DataType = "anyURI")]
+               public string Role;
+
+               public Soap12FaultDetail Detail;
+       }
+
+       [XmlType ("Code", Namespace = 
"http://www.w3.org/2003/05/soap-envelope";)]
+       public class Soap12FaultCode
+       {
+               public XmlQualifiedName Value;
+
+               public Soap12FaultCode Subcode;
+       }
+
+       [XmlType ("Reason", Namespace = 
"http://www.w3.org/2003/05/soap-envelope";)]
+       public class Soap12FaultReason
+       {
+               [XmlElement ("Text", Namespace = 
"http://www.w3.org/2003/05/soap-envelope";)]
+               public Soap12FaultReasonText [] Texts;
+       }
+
+       [XmlType ("Text", Namespace = 
"http://www.w3.org/2003/05/soap-envelope";)]
+       public class Soap12FaultReasonText
+       {
+               [XmlAttribute ("lang", Namespace = 
"http://www.w3.org/XML/1998/namespace";)]
+               public string XmlLang;
+
+               [XmlText]
+               public string Value;
+       }
+
+       [XmlType ("Detail", Namespace = 
"http://www.w3.org/2003/05/soap-envelope";)]
+       public class Soap12FaultDetail
+       {
+               [XmlAnyAttribute]
+               public XmlAttribute [] Attributes;
+
+               [XmlAnyElement]
+               public XmlElement [] Children;
+
+               [XmlText]
+               public string Text;
+       }
+}


Property changes on: 
branches/atsushi/mcs/class/System.Web.Services/System.Web.Services.Protocols/Fault12.cs
___________________________________________________________________
Name: svn:eol-style
   + native

Added: 
branches/atsushi/mcs/class/System.Web.Services/System.Web.Services.Protocols/Fault12Serializer.cs
===================================================================
--- 
branches/atsushi/mcs/class/System.Web.Services/System.Web.Services.Protocols/Fault12Serializer.cs
   2006-11-28 11:56:12 UTC (rev 68574)
+++ 
branches/atsushi/mcs/class/System.Web.Services/System.Web.Services.Protocols/Fault12Serializer.cs
   2006-11-28 12:38:22 UTC (rev 68575)
@@ -0,0 +1,653 @@
+#if NET_2_0
+using System;
+using System.Xml;
+using System.Xml.Schema;
+using System.Xml.Serialization;
+using System.Text;
+using System.Collections;
+using System.Globalization;
+
+namespace System.Web.Services.Protocols
+{
+       internal class Soap12FaultReader : XmlSerializationReader
+       {
+               public object ReadRoot_Soap12Fault ()
+               {
+                       Reader.MoveToContent();
+                       if (Reader.LocalName != "Fault" || Reader.NamespaceURI 
!= "http://www.w3.org/2003/05/soap-envelope";)
+                               throw CreateUnknownNodeException();
+                       return ReadObject_Fault (true, true);
+               }
+
+               public System.Web.Services.Protocols.Soap12Fault 
ReadObject_Fault (bool isNullable, bool checkType)
+               {
+                       System.Web.Services.Protocols.Soap12Fault ob = null;
+                       if (isNullable && ReadNull()) return null;
+
+                       if (checkType) 
+                       {
+                               System.Xml.XmlQualifiedName t = GetXsiType();
+                               if (t == null)
+                               { }
+                               else if (t.Name != "Fault" || t.Namespace != 
"http://www.w3.org/2003/05/soap-envelope";)
+                                       throw CreateUnknownTypeException(t);
+                       }
+
+                       ob = new System.Web.Services.Protocols.Soap12Fault ();
+
+                       Reader.MoveToElement();
+
+                       while (Reader.MoveToNextAttribute())
+                       {
+                               if (IsXmlnsAttribute (Reader.Name)) {
+                               }
+                               else {
+                                       UnknownNode (ob);
+                               }
+                       }
+
+                       Reader.MoveToElement();
+                       if (Reader.IsEmptyElement) {
+                               Reader.Skip ();
+                               return ob;
+                       }
+
+                       Reader.ReadStartElement();
+                       Reader.MoveToContent();
+
+                       bool b0=false, b1=false, b2=false, b3=false, b4=false;
+
+                       while (Reader.NodeType != 
System.Xml.XmlNodeType.EndElement) 
+                       {
+                               if (Reader.NodeType == 
System.Xml.XmlNodeType.Element) 
+                               {
+                                       if (Reader.LocalName == "Role" && 
Reader.NamespaceURI == "http://www.w3.org/2003/05/soap-envelope"; && !b3) {
+                                               b3 = true;
+                                               [EMAIL PROTECTED] = 
Reader.ReadElementString ();
+                                       }
+                                       else if (Reader.LocalName == "Detail" 
&& Reader.NamespaceURI == "http://www.w3.org/2003/05/soap-envelope"; && !b4) {
+                                               b4 = true;
+                                               [EMAIL PROTECTED] = 
ReadObject_Detail (false, true);
+                                       }
+                                       else if (Reader.LocalName == "Code" && 
Reader.NamespaceURI == "http://www.w3.org/2003/05/soap-envelope"; && !b0) {
+                                               b0 = true;
+                                               [EMAIL PROTECTED] = 
ReadObject_Code (false, true);
+                                       }
+                                       else if (Reader.LocalName == "Node" && 
Reader.NamespaceURI == "http://www.w3.org/2003/05/soap-envelope"; && !b2) {
+                                               b2 = true;
+                                               [EMAIL PROTECTED] = 
Reader.ReadElementString ();
+                                       }
+                                       else if (Reader.LocalName == "Reason" 
&& Reader.NamespaceURI == "http://www.w3.org/2003/05/soap-envelope"; && !b1) {
+                                               b1 = true;
+                                               [EMAIL PROTECTED] = 
ReadObject_Reason (false, true);
+                                       }
+                                       else {
+                                               UnknownNode (ob);
+                                       }
+                               }
+                               else
+                                       UnknownNode(ob);
+
+                               Reader.MoveToContent();
+                       }
+
+                       ReadEndElement();
+
+                       return ob;
+               }
+
+               public System.Web.Services.Protocols.Soap12FaultDetail 
ReadObject_Detail (bool isNullable, bool checkType)
+               {
+                       System.Web.Services.Protocols.Soap12FaultDetail ob = 
null;
+                       if (isNullable && ReadNull()) return null;
+
+                       if (checkType) 
+                       {
+                               System.Xml.XmlQualifiedName t = GetXsiType();
+                               if (t == null)
+                               { }
+                               else if (t.Name != "Detail" || t.Namespace != 
"http://www.w3.org/2003/05/soap-envelope";)
+                                       throw CreateUnknownTypeException(t);
+                       }
+
+                       ob = new 
System.Web.Services.Protocols.Soap12FaultDetail ();
+
+                       Reader.MoveToElement();
+
+                       int anyAttributeIndex = 0;
+                       System.Xml.XmlAttribute[] anyAttributeArray = null;
+                       while (Reader.MoveToNextAttribute())
+                       {
+                               if (IsXmlnsAttribute (Reader.Name)) {
+                               }
+                               else {
+                                       System.Xml.XmlAttribute attr = 
(System.Xml.XmlAttribute) Document.ReadNode(Reader);
+                                       anyAttributeArray = 
(System.Xml.XmlAttribute[]) EnsureArrayIndex (anyAttributeArray, 
anyAttributeIndex, typeof(System.Xml.XmlAttribute));
+                                       anyAttributeArray[anyAttributeIndex] = 
((System.Xml.XmlAttribute) attr);
+                                       anyAttributeIndex++;
+                               }
+                       }
+
+                       anyAttributeArray = (System.Xml.XmlAttribute[]) 
ShrinkArray (anyAttributeArray, anyAttributeIndex, 
typeof(System.Xml.XmlAttribute), true);
+                       [EMAIL PROTECTED] = anyAttributeArray;
+
+                       Reader.MoveToElement();
+                       if (Reader.IsEmptyElement) {
+                               Reader.Skip ();
+                               return ob;
+                       }
+
+                       Reader.ReadStartElement();
+                       Reader.MoveToContent();
+
+                       bool b5=false, b6=false;
+
+                       System.Xml.XmlElement[] o8;
+                       o8 = null;
+                       int n7=0;
+
+                       while (Reader.NodeType != 
System.Xml.XmlNodeType.EndElement) 
+                       {
+                               if (Reader.NodeType == 
System.Xml.XmlNodeType.Element) 
+                               {
+                                       o8 = (System.Xml.XmlElement[]) 
EnsureArrayIndex (o8, n7, typeof(System.Xml.XmlElement));
+                                       o8[n7] = ((System.Xml.XmlElement) 
ReadXmlNode (false));
+                                       n7++;
+                               }
+                               else if (Reader.NodeType == 
System.Xml.XmlNodeType.Text || Reader.NodeType == System.Xml.XmlNodeType.CDATA)
+                               {
+                                       [EMAIL PROTECTED] = ReadString ([EMAIL 
PROTECTED]);
+                               }
+                               else
+                                       UnknownNode(ob);
+
+                               Reader.MoveToContent();
+                       }
+
+                       o8 = (System.Xml.XmlElement[]) ShrinkArray (o8, n7, 
typeof(System.Xml.XmlElement), true);
+                       [EMAIL PROTECTED] = o8;
+
+                       ReadEndElement();
+
+                       return ob;
+               }
+
+               public System.Web.Services.Protocols.Soap12FaultCode 
ReadObject_Code (bool isNullable, bool checkType)
+               {
+                       System.Web.Services.Protocols.Soap12FaultCode ob = null;
+                       if (isNullable && ReadNull()) return null;
+
+                       if (checkType) 
+                       {
+                               System.Xml.XmlQualifiedName t = GetXsiType();
+                               if (t == null)
+                               { }
+                               else if (t.Name != "Code" || t.Namespace != 
"http://www.w3.org/2003/05/soap-envelope";)
+                                       throw CreateUnknownTypeException(t);
+                       }
+
+                       ob = new System.Web.Services.Protocols.Soap12FaultCode 
();
+
+                       Reader.MoveToElement();
+
+                       while (Reader.MoveToNextAttribute())
+                       {
+                               if (IsXmlnsAttribute (Reader.Name)) {
+                               }
+                               else {
+                                       UnknownNode (ob);
+                               }
+                       }
+
+                       Reader.MoveToElement();
+                       if (Reader.IsEmptyElement) {
+                               Reader.Skip ();
+                               return ob;
+                       }
+
+                       Reader.ReadStartElement();
+                       Reader.MoveToContent();
+
+                       bool b9=false, b10=false;
+
+                       while (Reader.NodeType != 
System.Xml.XmlNodeType.EndElement) 
+                       {
+                               if (Reader.NodeType == 
System.Xml.XmlNodeType.Element) 
+                               {
+                                       if (Reader.LocalName == "Value" && 
Reader.NamespaceURI == "http://www.w3.org/2003/05/soap-envelope"; && !b9) {
+                                               b9 = true;
+                                               [EMAIL PROTECTED] = 
ReadElementQualifiedName ();
+                                       }
+                                       else if (Reader.LocalName == "Subcode" 
&& Reader.NamespaceURI == "http://www.w3.org/2003/05/soap-envelope"; && !b10) {
+                                               b10 = true;
+                                               [EMAIL PROTECTED] = 
ReadObject_Code (false, true);
+                                       }
+                                       else {
+                                               UnknownNode (ob);
+                                       }
+                               }
+                               else
+                                       UnknownNode(ob);
+
+                               Reader.MoveToContent();
+                       }
+
+                       ReadEndElement();
+
+                       return ob;
+               }
+
+               public System.Web.Services.Protocols.Soap12FaultReason 
ReadObject_Reason (bool isNullable, bool checkType)
+               {
+                       System.Web.Services.Protocols.Soap12FaultReason ob = 
null;
+                       if (isNullable && ReadNull()) return null;
+
+                       if (checkType) 
+                       {
+                               System.Xml.XmlQualifiedName t = GetXsiType();
+                               if (t == null)
+                               { }
+                               else if (t.Name != "Reason" || t.Namespace != 
"http://www.w3.org/2003/05/soap-envelope";)
+                                       throw CreateUnknownTypeException(t);
+                       }
+
+                       ob = new 
System.Web.Services.Protocols.Soap12FaultReason ();
+
+                       Reader.MoveToElement();
+
+                       while (Reader.MoveToNextAttribute())
+                       {
+                               if (IsXmlnsAttribute (Reader.Name)) {
+                               }
+                               else {
+                                       UnknownNode (ob);
+                               }
+                       }
+
+                       Reader.MoveToElement();
+                       if (Reader.IsEmptyElement) {
+                               Reader.Skip ();
+                               return ob;
+                       }
+
+                       Reader.ReadStartElement();
+                       Reader.MoveToContent();
+
+                       bool b11=false;
+
+                       System.Web.Services.Protocols.Soap12FaultReasonText[] 
o13;
+                       o13 = null;
+                       int n12=0;
+
+                       while (Reader.NodeType != 
System.Xml.XmlNodeType.EndElement) 
+                       {
+                               if (Reader.NodeType == 
System.Xml.XmlNodeType.Element) 
+                               {
+                                       if (Reader.LocalName == "Text" && 
Reader.NamespaceURI == "http://www.w3.org/2003/05/soap-envelope"; && !b11) {
+                                               o13 = 
(System.Web.Services.Protocols.Soap12FaultReasonText[]) EnsureArrayIndex (o13, 
n12, typeof(System.Web.Services.Protocols.Soap12FaultReasonText));
+                                               o13[n12] = ReadObject_Text 
(false, true);
+                                               n12++;
+                                       }
+                                       else {
+                                               UnknownNode (ob);
+                                       }
+                               }
+                               else
+                                       UnknownNode(ob);
+
+                               Reader.MoveToContent();
+                       }
+
+                       o13 = 
(System.Web.Services.Protocols.Soap12FaultReasonText[]) ShrinkArray (o13, n12, 
typeof(System.Web.Services.Protocols.Soap12FaultReasonText), true);
+                       [EMAIL PROTECTED] = o13;
+
+                       ReadEndElement();
+
+                       return ob;
+               }
+
+               public System.Web.Services.Protocols.Soap12FaultReasonText 
ReadObject_Text (bool isNullable, bool checkType)
+               {
+                       System.Web.Services.Protocols.Soap12FaultReasonText ob 
= null;
+                       if (isNullable && ReadNull()) return null;
+
+                       if (checkType) 
+                       {
+                               System.Xml.XmlQualifiedName t = GetXsiType();
+                               if (t == null)
+                               { }
+                               else if (t.Name != "Text" || t.Namespace != 
"http://www.w3.org/2003/05/soap-envelope";)
+                                       throw CreateUnknownTypeException(t);
+                       }
+
+                       ob = new 
System.Web.Services.Protocols.Soap12FaultReasonText ();
+
+                       Reader.MoveToElement();
+
+                       while (Reader.MoveToNextAttribute())
+                       {
+                               if (Reader.LocalName == "lang" && 
Reader.NamespaceURI == "http://www.w3.org/XML/1998/namespace";) {
+                                       [EMAIL PROTECTED] = Reader.Value;
+                               }
+                               else if (IsXmlnsAttribute (Reader.Name)) {
+                               }
+                               else {
+                                       UnknownNode (ob);
+                               }
+                       }
+
+                       Reader.MoveToElement();
+                       if (Reader.IsEmptyElement) {
+                               Reader.Skip ();
+                               return ob;
+                       }
+
+                       Reader.ReadStartElement();
+                       Reader.MoveToContent();
+
+                       bool b14=false;
+
+                       while (Reader.NodeType != 
System.Xml.XmlNodeType.EndElement) 
+                       {
+                               if (Reader.NodeType == 
System.Xml.XmlNodeType.Element) 
+                               {
+                                       UnknownNode (ob);
+                               }
+                               else if (Reader.NodeType == 
System.Xml.XmlNodeType.Text || Reader.NodeType == System.Xml.XmlNodeType.CDATA)
+                               {
+                                       [EMAIL PROTECTED] = ReadString ([EMAIL 
PROTECTED]);
+                               }
+                               else
+                                       UnknownNode(ob);
+
+                               Reader.MoveToContent();
+                       }
+
+                       ReadEndElement();
+
+                       return ob;
+               }
+
+               protected override void InitCallbacks ()
+               {
+               }
+
+               protected override void InitIDs ()
+               {
+               }
+
+       }
+
+       internal class Soap12FaultWriter : XmlSerializationWriter
+       {
+               const string xmlNamespace = "http://www.w3.org/2000/xmlns/";;
+               public void WriteRoot_Soap12Fault (object o)
+               {
+                       WriteStartDocument ();
+                       System.Web.Services.Protocols.Soap12Fault ob = 
(System.Web.Services.Protocols.Soap12Fault) o;
+                       TopLevelElement ();
+                       WriteObject_Fault (ob, "Fault", 
"http://www.w3.org/2003/05/soap-envelope";, true, false, true);
+               }
+
+               void WriteObject_Fault 
(System.Web.Services.Protocols.Soap12Fault ob, string element, string namesp, 
bool isNullable, bool needType, bool writeWrappingElem)
+               {
+                       if (((object)ob) == null)
+                       {
+                               if (isNullable)
+                                       WriteNullTagLiteral(element, namesp);
+                               return;
+                       }
+
+                       System.Type type = ob.GetType ();
+                       if (type == 
typeof(System.Web.Services.Protocols.Soap12Fault))
+                       { }
+                       else {
+                               throw CreateUnknownTypeException (ob);
+                       }
+
+                       if (writeWrappingElem) {
+                               WriteStartElement (element, namesp, ob);
+                       }
+
+                       if (needType) WriteXsiType("Fault", 
"http://www.w3.org/2003/05/soap-envelope";);
+
+                       WriteObject_Code ([EMAIL PROTECTED], "Code", 
"http://www.w3.org/2003/05/soap-envelope";, false, false, true);
+                       WriteObject_Reason ([EMAIL PROTECTED], "Reason", 
"http://www.w3.org/2003/05/soap-envelope";, false, false, true);
+                       WriteElementString ("Node", 
"http://www.w3.org/2003/05/soap-envelope";, (([EMAIL PROTECTED] != null) ? 
([EMAIL PROTECTED]).ToString() : null));
+                       WriteElementString ("Role", 
"http://www.w3.org/2003/05/soap-envelope";, (([EMAIL PROTECTED] != null) ? 
([EMAIL PROTECTED]).ToString() : null));
+                       WriteObject_Detail ([EMAIL PROTECTED], "Detail", 
"http://www.w3.org/2003/05/soap-envelope";, false, false, true);
+                       if (writeWrappingElem) WriteEndElement (ob);
+               }
+
+               void WriteObject_Code 
(System.Web.Services.Protocols.Soap12FaultCode ob, string element, string 
namesp, bool isNullable, bool needType, bool writeWrappingElem)
+               {
+                       if (((object)ob) == null)
+                       {
+                               if (isNullable)
+                                       WriteNullTagLiteral(element, namesp);
+                               return;
+                       }
+
+                       System.Type type = ob.GetType ();
+                       if (type == 
typeof(System.Web.Services.Protocols.Soap12FaultCode))
+                       { }
+                       else {
+                               throw CreateUnknownTypeException (ob);
+                       }
+
+                       if (writeWrappingElem) {
+                               WriteStartElement (element, namesp, ob);
+                       }
+
+                       if (needType) WriteXsiType("Code", 
"http://www.w3.org/2003/05/soap-envelope";);
+
+                       WriteElementQualifiedName ("Value", 
"http://www.w3.org/2003/05/soap-envelope";, [EMAIL PROTECTED]);
+                       WriteObject_Code ([EMAIL PROTECTED], "Subcode", 
"http://www.w3.org/2003/05/soap-envelope";, false, false, true);
+                       if (writeWrappingElem) WriteEndElement (ob);
+               }
+
+               void WriteObject_Reason 
(System.Web.Services.Protocols.Soap12FaultReason ob, string element, string 
namesp, bool isNullable, bool needType, bool writeWrappingElem)
+               {
+                       if (((object)ob) == null)
+                       {
+                               if (isNullable)
+                                       WriteNullTagLiteral(element, namesp);
+                               return;
+                       }
+
+                       System.Type type = ob.GetType ();
+                       if (type == 
typeof(System.Web.Services.Protocols.Soap12FaultReason))
+                       { }
+                       else {
+                               throw CreateUnknownTypeException (ob);
+                       }
+
+                       if (writeWrappingElem) {
+                               WriteStartElement (element, namesp, ob);
+                       }
+
+                       if (needType) WriteXsiType("Reason", 
"http://www.w3.org/2003/05/soap-envelope";);
+
+                       if ([EMAIL PROTECTED] != null) {
+                               for (int n15 = 0; n15 < [EMAIL PROTECTED]; 
n15++) {
+                                       WriteObject_Text ([EMAIL PROTECTED], 
"Text", "http://www.w3.org/2003/05/soap-envelope";, false, false, true);
+                               }
+                       }
+                       if (writeWrappingElem) WriteEndElement (ob);
+               }
+
+               void WriteObject_Detail 
(System.Web.Services.Protocols.Soap12FaultDetail ob, string element, string 
namesp, bool isNullable, bool needType, bool writeWrappingElem)
+               {
+                       if (((object)ob) == null)
+                       {
+                               if (isNullable)
+                                       WriteNullTagLiteral(element, namesp);
+                               return;
+                       }
+
+                       System.Type type = ob.GetType ();
+                       if (type == 
typeof(System.Web.Services.Protocols.Soap12FaultDetail))
+                       { }
+                       else {
+                               throw CreateUnknownTypeException (ob);
+                       }
+
+                       if (writeWrappingElem) {
+                               WriteStartElement (element, namesp, ob);
+                       }
+
+                       if (needType) WriteXsiType("Detail", 
"http://www.w3.org/2003/05/soap-envelope";);
+
+                       ICollection o16 = [EMAIL PROTECTED];
+                       if (o16 != null) {
+                               foreach (XmlAttribute o17 in o16)
+                                       if (o17.NamespaceURI != xmlNamespace)
+                                               WriteXmlAttribute (o17, ob);
+                       }
+
+                       if ([EMAIL PROTECTED] != null) {
+                               foreach (XmlNode o18 in [EMAIL PROTECTED]) {
+                                       XmlNode o19 = o18;
+                                       if (o19 is XmlElement) {
+                                       }
+                                       else o19.WriteTo (Writer);
+                                       WriteElementLiteral (o19, "", "", 
false, true);
+                               }
+                       }
+                       WriteValue ([EMAIL PROTECTED]);
+                       if (writeWrappingElem) WriteEndElement (ob);
+               }
+
+               void WriteObject_Text 
(System.Web.Services.Protocols.Soap12FaultReasonText ob, string element, string 
namesp, bool isNullable, bool needType, bool writeWrappingElem)
+               {
+                       if (((object)ob) == null)
+                       {
+                               if (isNullable)
+                                       WriteNullTagLiteral(element, namesp);
+                               return;
+                       }
+
+                       System.Type type = ob.GetType ();
+                       if (type == 
typeof(System.Web.Services.Protocols.Soap12FaultReasonText))
+                       { }
+                       else {
+                               throw CreateUnknownTypeException (ob);
+                       }
+
+                       if (writeWrappingElem) {
+                               WriteStartElement (element, namesp, ob);
+                       }
+
+                       if (needType) WriteXsiType("Text", 
"http://www.w3.org/2003/05/soap-envelope";);
+
+                       WriteAttribute ("lang", 
"http://www.w3.org/XML/1998/namespace";, [EMAIL PROTECTED]);
+
+                       WriteValue ([EMAIL PROTECTED]);
+                       if (writeWrappingElem) WriteEndElement (ob);
+               }
+
+               protected override void InitCallbacks ()
+               {
+               }
+
+       }
+
+
+       internal class Soap12FaultBaseSerializer : 
System.Xml.Serialization.XmlSerializer
+       {
+               protected override 
System.Xml.Serialization.XmlSerializationReader CreateReader () {
+                       return new Soap12FaultReader ();
+               }
+
+               protected override 
System.Xml.Serialization.XmlSerializationWriter CreateWriter () {
+                       return new Soap12FaultWriter ();
+               }
+
+               public override bool CanDeserialize (System.Xml.XmlReader 
xmlReader) {
+                       return true;
+               }
+       }
+
+       internal sealed class Fault12Serializer : Soap12FaultBaseSerializer
+       {
+               protected override void Serialize (object obj, 
System.Xml.Serialization.XmlSerializationWriter writer) {
+                       ((Soap12FaultWriter)writer).WriteRoot_Soap12Fault(obj);
+               }
+
+               protected override object Deserialize 
(System.Xml.Serialization.XmlSerializationReader reader) {
+                       return 
((Soap12FaultReader)reader).ReadRoot_Soap12Fault();
+               }
+       }
+
+       internal class Soap12FaultSerializerImplementation : 
System.Xml.Serialization.XmlSerializerImplementation
+       {
+               System.Collections.Hashtable readMethods = null;
+               System.Collections.Hashtable writeMethods = null;
+               System.Collections.Hashtable typedSerializers = null;
+
+               public override System.Xml.Serialization.XmlSerializationReader 
Reader {
+                       get {
+                               return new Soap12FaultReader();
+                       }
+               }
+
+               public override System.Xml.Serialization.XmlSerializationWriter 
Writer {
+                       get {
+                               return new Soap12FaultWriter();
+                       }
+               }
+
+               public override System.Collections.Hashtable ReadMethods {
+                       get {
+                               lock (this) {
+                                       if (readMethods == null) {
+                                               readMethods = new 
System.Collections.Hashtable ();
+                                               readMethods.Add (@"", 
@"ReadRoot_Soap12Fault");
+                                       }
+                                       return readMethods;
+                               }
+                       }
+               }
+
+               public override System.Collections.Hashtable WriteMethods {
+                       get {
+                               lock (this) {
+                                       if (writeMethods == null) {
+                                               writeMethods = new 
System.Collections.Hashtable ();
+                                               writeMethods.Add (@"", 
@"WriteRoot_Soap12Fault");
+                                       }
+                                       return writeMethods;
+                               }
+                       }
+               }
+
+               public override System.Collections.Hashtable TypedSerializers {
+                       get {
+                               lock (this) {
+                                       if (typedSerializers == null) {
+                                               typedSerializers = new 
System.Collections.Hashtable ();
+                                               typedSerializers.Add (@"", new 
FaultSerializer());
+                                       }
+                                       return typedSerializers;
+                               }
+                       }
+               }
+
+               public override XmlSerializer GetSerializer (Type type)
+               {
+                       switch (type.FullName) {
+                       case "System.Web.Services.Protocols.Soap12Fault":
+                               return (XmlSerializer) TypedSerializers [""];
+
+                       }
+                       return base.GetSerializer (type);
+               }
+
+               public override bool CanSerialize (System.Type type) {
+                       if (type == 
typeof(System.Web.Services.Protocols.Soap12Fault)) return true;
+                       return false;
+               }
+       }
+
+}
+#endif


Property changes on: 
branches/atsushi/mcs/class/System.Web.Services/System.Web.Services.Protocols/Fault12Serializer.cs
___________________________________________________________________
Name: svn:eol-style
   + native

Modified: 
branches/atsushi/mcs/class/System.Web.Services/System.Web.Services.Protocols/HttpSoapWebServiceHandler.cs
===================================================================
--- 
branches/atsushi/mcs/class/System.Web.Services/System.Web.Services.Protocols/HttpSoapWebServiceHandler.cs
   2006-11-28 11:56:12 UTC (rev 68574)
+++ 
branches/atsushi/mcs/class/System.Web.Services/System.Web.Services.Protocols/HttpSoapWebServiceHandler.cs
   2006-11-28 12:38:22 UTC (rev 68575)
@@ -296,10 +296,26 @@
 
                                if (message.Exception == null)
                                        WebServiceHelper.WriteSoapMessage (xtw, 
methodInfo, SoapHeaderDirection.Out, message.OutParameters, message.Headers, 
soap12);
-                               else if (methodInfo != null)
-                                       WebServiceHelper.WriteSoapMessage (xtw, 
methodInfo, SoapHeaderDirection.Fault, new Fault (message.Exception), 
message.Headers, soap12);
-                               else
-                                       WebServiceHelper.WriteSoapMessage (xtw, 
SoapBindingUse.Literal, Fault.Serializer, null, new Fault (message.Exception), 
null, soap12);
+                               else if (methodInfo != null) {
+#if NET_2_0
+                                       if (soap12)
+                                               
WebServiceHelper.WriteSoapMessage (xtw, methodInfo, SoapHeaderDirection.Fault, 
new Soap12Fault (message.Exception), message.Headers, soap12);
+                                       else
+#endif
+                                       {
+                                               
WebServiceHelper.WriteSoapMessage (xtw, methodInfo, SoapHeaderDirection.Fault, 
new Fault (message.Exception), message.Headers, soap12);
+                                       }
+                               }
+                               else {
+#if NET_2_0
+                                       if (soap12)
+                                               
WebServiceHelper.WriteSoapMessage (xtw, SoapBindingUse.Literal, 
Soap12Fault.Serializer, null, new Soap12Fault (message.Exception), null, 
soap12);
+                                       else
+#endif
+                                       {
+                                               
WebServiceHelper.WriteSoapMessage (xtw, SoapBindingUse.Literal, 
Fault.Serializer, null, new Fault (message.Exception), null, soap12);
+                                       }
+                               }
 
                                if (bufferResponse)
                                {

Modified: 
branches/atsushi/mcs/class/System.Web.Services/System.Web.Services.Protocols/Methods.cs
===================================================================
--- 
branches/atsushi/mcs/class/System.Web.Services/System.Web.Services.Protocols/Methods.cs
     2006-11-28 11:56:12 UTC (rev 68574)
+++ 
branches/atsushi/mcs/class/System.Web.Services/System.Web.Services.Protocols/Methods.cs
     2006-11-28 12:38:22 UTC (rev 68575)
@@ -379,12 +379,12 @@
                        return null;
                }
                
-               public XmlSerializer GetBodySerializer (SoapHeaderDirection dir)
+               public XmlSerializer GetBodySerializer (SoapHeaderDirection 
dir, bool soap12)
                {
                        switch (dir) {
                                case SoapHeaderDirection.In: return 
RequestSerializer;
                                case SoapHeaderDirection.Out: return 
ResponseSerializer;
-                               case SoapHeaderDirection.Fault: return 
Fault.Serializer;
+                               case SoapHeaderDirection.Fault: return soap12 ? 
Soap12Fault.Serializer : Fault.Serializer;
                                default: return null;
                        }
                }

Modified: 
branches/atsushi/mcs/class/System.Web.Services/System.Web.Services.Protocols/SoapException.cs
===================================================================
--- 
branches/atsushi/mcs/class/System.Web.Services/System.Web.Services.Protocols/SoapException.cs
       2006-11-28 11:56:12 UTC (rev 68574)
+++ 
branches/atsushi/mcs/class/System.Web.Services/System.Web.Services.Protocols/SoapException.cs
       2006-11-28 12:38:22 UTC (rev 68575)
@@ -129,12 +129,8 @@
                }
                
                public SoapException (string message, XmlQualifiedName code, 
string actor, string role, string lang, XmlNode detail, SoapFaultSubCode 
subcode, Exception innerException)
+                       : this (message, code, actor, role, detail, subcode, 
innerException)
                {
-                       this.code = code;
-                       this.subcode = subcode;
-                       this.detail = detail;
-                       this.actor = actor;
-                       this.role = role;
                        this.lang = lang;
                }
 

Modified: 
branches/atsushi/mcs/class/System.Web.Services/System.Web.Services.Protocols/SoapHttpClientProtocol.cs
===================================================================
--- 
branches/atsushi/mcs/class/System.Web.Services/System.Web.Services.Protocols/SoapHttpClientProtocol.cs
      2006-11-28 11:56:12 UTC (rev 68574)
+++ 
branches/atsushi/mcs/class/System.Web.Services/System.Web.Services.Protocols/SoapHttpClientProtocol.cs
      2006-11-28 12:38:22 UTC (rev 68575)
@@ -291,7 +291,32 @@
                                WebServiceHelper.ReadSoapMessage (xml_reader, 
msi, SoapHeaderDirection.Out, out content, out headers);
                        }
 
-                       
+#if NET_2_0
+                       if (content is Soap12Fault)
+                       {
+                               Soap12Fault fault = (Soap12Fault) content;
+                               Soap12FaultReasonText text =
+                                       fault.Reason != null &&
+                                       fault.Reason.Texts != null &&
+                                       fault.Reason.Texts.Length > 0 ?
+                                       fault.Reason.Texts [0] : null;
+                               XmlNode detail = (fault.Detail == null) ? null :
+                                       (fault.Detail.Children != null &&
+                                       fault.Detail.Children.Length > 0) ?
+                                       (XmlNode) fault.Detail.Children [0] :
+                                       (fault.Detail.Attributes != null &&
+                                       fault.Detail.Attributes.Length > 0) ?
+                                       fault.Detail.Attributes [0] : null;
+                               SoapFaultSubCode subcode = 
Soap12Fault.GetSoapFaultSubCode (fault.Code.Subcode);
+                               SoapException ex = new SoapException (
+                                       text != null ? text.Value : null,
+                                       fault.Code.Value, null, fault.Role,
+                                       text != null ? text.XmlLang : null,
+                                       detail, subcode, null);
+                               message.SetException (ex);
+                       }
+                       else
+#endif
                        if (content is Fault)
                        {
                                Fault fault = (Fault) content;

Modified: 
branches/atsushi/mcs/class/System.Web.Services/System.Web.Services.Protocols/WebServiceHelper.cs
===================================================================
--- 
branches/atsushi/mcs/class/System.Web.Services/System.Web.Services.Protocols/WebServiceHelper.cs
    2006-11-28 11:56:12 UTC (rev 68574)
+++ 
branches/atsushi/mcs/class/System.Web.Services/System.Web.Services.Protocols/WebServiceHelper.cs
    2006-11-28 12:38:22 UTC (rev 68575)
@@ -105,7 +105,7 @@
                public static void WriteSoapMessage (XmlTextWriter xtw, 
SoapMethodStubInfo method, SoapHeaderDirection dir, object bodyContent, 
SoapHeaderCollection headers, bool soap12)
                {
                        SoapBindingUse methodUse = dir == 
SoapHeaderDirection.Fault ? SoapBindingUse.Literal : method.Use;
-                       XmlSerializer bodySerializer = method.GetBodySerializer 
(dir);
+                       XmlSerializer bodySerializer = method.GetBodySerializer 
(dir, soap12);
                        XmlSerializer headerSerializer = 
method.GetHeaderSerializer (dir);
                        object[] headerArray = method.GetHeaderValueArray (dir, 
headers);
                        WriteSoapMessage (xtw, methodUse, bodySerializer, 
headerSerializer, bodyContent, headerArray, soap12);
@@ -147,7 +147,7 @@
 
                public static void ReadSoapMessage (XmlTextReader xmlReader, 
SoapMethodStubInfo method, SoapHeaderDirection dir, out object body, out 
SoapHeaderCollection headers)
                {
-                       XmlSerializer bodySerializer = method.GetBodySerializer 
(dir);
+                       XmlSerializer bodySerializer = method.GetBodySerializer 
(dir, false);// no need to worry about soap12 arg since no call for Fault 
anyways here.
                        XmlSerializer headerSerializer = 
method.GetHeaderSerializer (dir);
                        ReadSoapMessage (xmlReader, bodySerializer, 
headerSerializer, out body, out headers);
                }
@@ -174,7 +174,7 @@
                        xmlReader.MoveToContent ();
                        
                        if (xmlReader.LocalName == "Fault" && 
xmlReader.NamespaceURI == ns)
-                               bodySerializer = Fault.Serializer;
+                               bodySerializer = ns == Soap12EnvelopeNamespace 
? Soap12Fault.Serializer : Fault.Serializer;
 
                        body = bodySerializer.Deserialize (xmlReader);
                }

Added: 
branches/atsushi/mcs/class/System.Web.Services/System.Web.Services.Protocols/fault-12.genxs
===================================================================
--- 
branches/atsushi/mcs/class/System.Web.Services/System.Web.Services.Protocols/fault-12.genxs
 2006-11-28 11:56:12 UTC (rev 68574)
+++ 
branches/atsushi/mcs/class/System.Web.Services/System.Web.Services.Protocols/fault-12.genxs
 2006-11-28 12:38:22 UTC (rev 68575)
@@ -0,0 +1,16 @@
+<!--
+       This file is to build Soap12FaultSerializer. Run
+       MONO_PATH=[path_to_net_2_0] mono [path_to_]genxs.exe web-reference.genxs
+       and surround the resulting file with #if NET_2_0 and #endif.
+-->
+<configuration>
+       <serializer class="System.Web.Services.Protocols.Soap12Fault" 
assembly="System.Web.Services">
+               <reader>Soap12FaultReader</reader>
+               <writer>Soap12FaultWriter</writer>
+               <generateAsInternal>true</generateAsInternal>
+               <namespace>System.Web.Services.Protocols</namespace>
+               <outFileName>Fault12Serializer.cs</outFileName>
+               <baseSerializer>Soap12FaultBaseSerializer</baseSerializer>
+               
<implementation>Soap12FaultSerializerImplementation</implementation>
+       </serializer>
+</configuration>

Modified: 
branches/atsushi/mcs/class/System.Web.Services/System.Web.Services.dll.sources
===================================================================
--- 
branches/atsushi/mcs/class/System.Web.Services/System.Web.Services.dll.sources  
    2006-11-28 11:56:12 UTC (rev 68574)
+++ 
branches/atsushi/mcs/class/System.Web.Services/System.Web.Services.dll.sources  
    2006-11-28 12:38:22 UTC (rev 68575)
@@ -125,6 +125,8 @@
 System.Web.Services.Protocols/Methods.cs
 System.Web.Services.Protocols/AnyReturnReader.cs
 System.Web.Services.Protocols/Fault.cs
+System.Web.Services.Protocols/Fault12.cs
+System.Web.Services.Protocols/Fault12Serializer.cs
 System.Web.Services.Protocols/HtmlFormParameterReader.cs
 System.Web.Services.Protocols/HtmlFormParameterWriter.cs
 System.Web.Services.Protocols/HttpGetClientProtocol.cs

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to