2003-10-08 Todd Berman <tberman@gentoo.org>
authorTodd Berman <tberman@mono-cvs.ximian.com>
Thu, 9 Oct 2003 04:44:36 +0000 (04:44 -0000)
committerTodd Berman <tberman@mono-cvs.ximian.com>
Thu, 9 Oct 2003 04:44:36 +0000 (04:44 -0000)
        * RelatesTo.cs: Implemented
        * ReplyTo.cs: Implemented
        * To.cs: Implemented

svn path=/trunk/mcs/; revision=18791

mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Addressing/ChangeLog
mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Addressing/RelatesTo.cs [new file with mode: 0644]
mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Addressing/ReplyTo.cs
mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Addressing/To.cs

index ff0b0b239621736dd20d4373c524c5f28c5c5a09..82749a6e32398046a9d6b72508ed94ee7d819ce9 100644 (file)
@@ -1,3 +1,9 @@
+2003-10-08  Todd Berman <tberman@gentoo.org>
+
+       * RelatesTo.cs: Implemented
+       * ReplyTo.cs: Implemented
+       * To.cs: Implemented
+
 2003-10-08  Todd Berman <tberman@gentoo.org>
 
        * FaultTo.cs: Implemented
diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Addressing/RelatesTo.cs b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Addressing/RelatesTo.cs
new file mode 100644 (file)
index 0000000..80fec33
--- /dev/null
@@ -0,0 +1,101 @@
+//
+// Microsoft.Web.Services.Addressing.RelatesTo.cs
+//
+// Author: Todd Berman <tberman@gentoo.org>
+//
+// (C) 2003 Todd Berman
+
+using System;
+using System.Xml;
+using Microsoft.Web.Services.Xml;
+
+namespace Microsoft.Web.Services.Addressing
+{
+       public class RelatesTo : AttributedUri, IXmlElement
+       {
+               private QualifiedName _type;
+
+               public RelatesTo (XmlElement element) : base ()
+               {
+                       _type = new QualifiedName ("wsa",
+                                                  "Response",
+                                                  "http://schemas.xmlsoap.org/ws/2003/03/addressing");
+                       LoadXml (element);
+               }
+
+               public RelatesTo (Uri uri) : base (uri)
+               {
+                       _type = new QualifiedName ("wsa",
+                                                  "Response",
+                                                  "http://schemas.xmlsoap.org/ws/2003/03/addressing");
+                       if(uri == null) {
+                               throw new ArgumentNullException ("related");
+                       }
+               }
+
+               public XmlElement GetXml (XmlDocument document)
+               {
+                       if(document == null) {
+                               throw new ArgumentNullException ("related");
+                       }
+                       XmlElement element = document.CreateElement ("wsa",
+                                                                    "RelatesTo",
+                                                                    "http://schemas.xmlsoap.org/ws/2003/03/addressing");
+                       if(_type != null) {
+                               XmlAttribute attrib = document.CreateAttribute ("RelationshipType");
+
+                               attrib.Value = _type.Value;
+
+                               element.Attributes.Append (attrib);
+
+                               if(_type.Namespace != "http://schemas.xmlsoap.org/ws/2003/03/addressing") {
+                                       element.Attributes.Append (_type.GetNamespaceDecl (document));
+                               }
+                       }
+
+                       GetXmlUri (document, element);
+                       return element;
+               }
+
+               public void LoadXml (XmlElement element)
+               {
+                       if(element == null) {
+                               throw new ArgumentNullException ("element");
+                       }
+
+                       if(element.LocalName != "RelatesTo" || element.NamespaceURI != "http://schemas.xmlsoap.org/ws/2003/03/addressing") {
+                               throw new ArgumentException ("Invalid Element Supplied");
+                       }
+
+                       ValidateSchema (element);
+
+                       _type = new QualifiedName ("wsa",
+                                                  "Response",
+                                                  "http://schemas.xmlsoap.org/ws/2003/03/addressing");
+
+                       foreach(XmlAttribute attrib in element.Attributes) {
+                               if(attrib.LocalName == "RelationshipType") {
+                                       _type = QualifiedName.FromString (attrib.InnerText, element);
+                               } else {
+                                       AnyAttributes.Add (attrib);
+                               }
+                       }
+
+                       Value = new Uri (element.InnerText);
+                       
+               }
+
+               public static implicit operator RelatesTo (Uri uri)
+               {
+                       return new RelatesTo (uri);
+               }
+
+               public static implicit operator Uri (RelatesTo obj)
+               {
+                       if(obj == null) {
+                               return null;
+                       }
+                       return obj.Value;
+               }
+       }
+}
index c0c80bde6918a80d43bdad92813828f5fe7a70ff..732250ad6fa60e59e3cef3043b31c8db4d2ac405 100644 (file)
@@ -15,22 +15,56 @@ namespace Microsoft.Web.Services.Addressing
        public class ReplyTo : EndpointReferenceType, IXmlElement
        {
 
-               [MonoTODO()]
-               public ReplyTo (Uri address)
+               public ReplyTo (Address address) : base (address)
+               {
+               }
+               
+               public ReplyTo (Uri address) : base (address)
                {
-                       throw new NotImplementedException ();
                }
 
-               [MonoTODO()]
+               public ReplyTo (XmlElement element) : base ()
+               {
+                       LoadXml (element);
+               }
+               
                public XmlElement GetXml (XmlDocument document)
                {
-                       throw new NotImplementedException ();
+                       if(document == null) {
+                               throw new ArgumentNullException ("document");
+                       }
+
+                       XmlElement element = document.CreateElement ("wsa",
+                                                                    "ReplyTo",
+                                                                    "http://schemas.xmlsoap.org/2003/03/addressing");
+                       GetXmlAny (document, element);
+                       return element;
                }
 
-               [MonoTODO()]
                public void LoadXml (XmlElement element)
                {
-                       throw new NotImplementedException ();
+                       if(element == null) {
+                               throw new ArgumentNullException ("element");
+                       }
+
+                       if(element.LocalName != "ReplyTo" || element.NamespaceURI != "http://schemas.xmlsoap.org/2003/03/addressing") {
+                               throw new ArgumentException ("Invalid Argument Supplied");
+                       }
+
+                       LoadXmlAny (element);
+               }
+
+               public static implicit operator ReplyTo (Uri uri)
+               {
+                       return new ReplyTo (uri);
+               }
+
+               public static implicit operator Uri (ReplyTo obj)
+               {
+                       if(obj == null) {
+                               return null;
+                       }
+                       return obj.Address.Value;
                }
 
        }
index 64c61a12e0cd511ac566a0dd2439710401fa8e24..dacae94ad08a291eaa3d3e2cdad6104a6af523c5 100644 (file)
@@ -15,16 +15,57 @@ namespace Microsoft.Web.Services.Addressing
        public class To : AttributedUri, IXmlElement
        {
 
-               [MonoTODO]
+               public To (AttributedUri uri) : base (uri)
+               {
+               }
+
+               public To (Uri uri) : base (uri)
+               {
+               }
+
+               public To (XmlElement element) : base ()
+               {
+                       LoadXml (element);
+               }
+               
                public XmlElement GetXml (XmlDocument document)
                {
-                       throw new NotImplementedException ();
+                       if(document == null) {
+                               throw new ArgumentNullException ("document");
+                       }
+                       
+                       XmlElement element = document.CreateElement ("wsa",
+                                                                    "To",
+                                                                    "http://schemas.xmlsoap.org/2003/03/addressing");
+
+                       GetXmlUri (document, element);
+                       return element;
                }
 
-               [MonoTODO]
                public void LoadXml (XmlElement element)
                {
-                       throw new NotImplementedException ();
+                       if(element == null) {
+                               throw new ArgumentNullException ("element");
+                       }
+
+                       if(element.LocalName != "To" || element.NamespaceURI != "http://schemas.xmlsoap.org/2003/03/addressing") {
+                               throw new ArgumentException ("Invalid Element Supplied");
+                       }
+
+                       LoadXmlUri (element);
+               }
+
+               public static implicit operator To (Uri uri)
+               {
+                       return new To (uri);
+               }
+
+               public static implicit operator Uri (To obj)
+               {
+                       if(obj == null) {
+                               return null;
+                       }
+                       return obj.Value;
                }
 
        }