2003-10-07 Todd Berman <tberman@gentoo.org>
authorTodd Berman <tberman@mono-cvs.ximian.com>
Tue, 7 Oct 2003 23:34:25 +0000 (23:34 -0000)
committerTodd Berman <tberman@mono-cvs.ximian.com>
Tue, 7 Oct 2003 23:34:25 +0000 (23:34 -0000)
        * ReferenceProperties.cs: Implemented
        * ServiceName.cs: Partially Implemented
        * EndpointReferenceType.cs: Implemented
        * EndpointReference.cs: Implemented

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

mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Addressing/ChangeLog
mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Addressing/EndpointReference.cs
mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Addressing/EndpointReferenceType.cs
mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Addressing/ReferenceProperties.cs [new file with mode: 0644]
mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Addressing/ServiceName.cs [new file with mode: 0644]

index e63335bf8bcf7bfde08dec361747c05f92be188a..84cc19799a80b38bbadc780e817b48c9b9343928 100644 (file)
@@ -1,3 +1,10 @@
+2003-10-07  Todd Berman <tberman@gentoo.org>
+
+       * ReferenceProperties.cs: Implemented
+       * ServiceName.cs: Partially Implemented
+       * EndpointReferenceType.cs: Implemented
+       * EndpointReference.cs: Implemented
+
 2003-10-05  Todd Berman <tberman@gentoo.org>
 
        * AddressList.cs: Implemented.
index 56db486cc4cfec71bd15ca1297fe78236b3121e8..95ef664fbae930ef1569fd09e2c190c1f25adc60 100644 (file)
@@ -15,14 +15,54 @@ namespace Microsoft.Web.Services.Addressing
        public class EndpointReference : EndpointReferenceType, IXmlElement
        {
 
+               public EndpointReference (Address address) : base (address)
+               {
+               }
+
+               public EndpointReference (Uri uri) : base (uri)
+               {
+               }
+
+               public EndpointReference (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",
+                                                                    "EndpointReference",
+                                                                    "http://schemas.xmlsoap.org/ws/2003/03/addressing");
+                       
+                       GetXmlAny (document, element);
+                       return element;
                }
 
                public void LoadXml (XmlElement element)
                {
-                       throw new NotImplementedException ();
+                       if(element == null) {
+                               throw new ArgumentNullException ("element");
+                       }
+                       if(element.LocalName != "EndpointReference" || element.NamespaceURI != "http://schemas.xmlsoap.org/ws/2003/03/addressing") {
+                               throw new ArgumentException ("Invalid Element Supplied");
+                       }
+                       LoadXmlAny (element);
+               }
+
+               public static implicit operator EndpointReference (Uri uri)
+               {
+                       return new EndpointReference (uri);
+               }
+
+               public static implicit operator Uri (EndpointReference obj)
+               {
+                       if(obj == null) {
+                               return null;
+                       }
+                       return obj.Address.Value;
                }
 
        }
index 1ec81bdb3dc594d1114c9c4a798e8fd1813d8f0b..839dab021418b5f21512f04d24585b35bb7e8322 100644 (file)
@@ -6,6 +6,7 @@
 // (C) 2003 Todd Berman
 
 using System;
+using System.Xml;
 using Microsoft.Web.Services.Xml;
 
 namespace Microsoft.Web.Services.Addressing
@@ -14,11 +15,113 @@ namespace Microsoft.Web.Services.Addressing
        public abstract class EndpointReferenceType : OpenElement
        {
 
-               private Address address;
+               private Address _address;
+               private PortType _portType;
+               private ReferenceProperties _properties;
+               private ServiceName _serviceName;
+
+               public EndpointReferenceType (Uri address) : base ()
+               {
+                       if(address == null) {
+                               throw new ArgumentNullException ("address");
+                       }
+                       _address = new Address (address);
+               }
+
+               public EndpointReferenceType (Address address) : base ()
+               {
+                       if(address == null) {
+                               throw new ArgumentNullException ("address");
+                       }
+                       _address = address;
+               }
+
+               public EndpointReferenceType () : base ()
+               {
+               }
+
+               public new void GetXmlAny (XmlDocument document, XmlElement element)
+               {
+                       if(document == null) {
+                               throw new ArgumentNullException ("document");
+                       }
+                       if(element == null) {
+                               throw new ArgumentNullException ("element");
+                       }
+
+                       element.AppendChild (_address.GetXml (document));
+                       
+                       if(_portType != null) {
+                               element.AppendChild (_portType.GetXml (document));
+                       }
+
+                       if(_properties != null) {
+                               element.AppendChild (_properties.GetXml (document));
+                       }
+
+                       if(_serviceName != null) {
+                               element.AppendChild (_serviceName.GetXml (document));
+                       }
+
+                       base.GetXmlAny (document, element);
+               }
+
+               public new void LoadXmlAny (XmlElement element)
+               {
+                       if(element == null) {
+                               throw new ArgumentNullException ("element");
+                       }
+
+                       foreach (XmlAttribute attrib in element.Attributes) {
+                               AnyAttributes.Add (attrib);
+                       }
+
+                       foreach (XmlElement node in element.ChildNodes) {
+                               if(node.NamespaceURI != "http://schemas.xmlsoap.org/ws/2003/03/addressing") {
+                                       continue;
+                               }
+                               switch (node.LocalName) {
+                                       case "Address":
+                                               _address = new Address (node);
+                                               break;
+                                       case "ReferenceProperties":
+                                               _properties = new ReferenceProperties (node);
+                                               break;
+                                       case "PortType":
+                                               _portType = new PortType (node);
+                                               break;
+                                       case "ServiceName":
+                                               _serviceName = new ServiceName (node);
+                                               break;
+                               }
+
+                               AnyElements.Add (node);
+                       }
+               }
 
                public Address Address {
-                       get { return address; }
-                       set { address = value; }
+                       get { return _address; }
+                       set { 
+                               if(value == null) {
+                                       throw new ArgumentNullException ("Address");
+                               }
+                               _address = value; 
+                       }
+               }
+
+               public PortType PortType {
+                       get { return _portType; }
+                       set { _portType = null; }
+               }
+
+               public ReferenceProperties ReferenceProperties {
+                       get { return _properties; }
+                       set { _properties = value; }
+               }
+
+               public ServiceName ServiceName {
+                       get { return _serviceName; }
+                       set { _serviceName = value; }
                }
 
        }
diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Addressing/ReferenceProperties.cs b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Addressing/ReferenceProperties.cs
new file mode 100644 (file)
index 0000000..9a3ec1a
--- /dev/null
@@ -0,0 +1,54 @@
+//
+// Microsoft.Web.Services.Addressing.ReferenceProperties.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 ReferenceProperties : OpenElementElement, IXmlElement
+       {
+               public ReferenceProperties (XmlElement element) : base ()
+               {
+                       LoadXml (element);
+               }
+
+               public ReferenceProperties () : base ()
+               {
+               }
+
+               public XmlElement GetXml (XmlDocument document)
+               {
+                       if(document == null) {
+                               throw new ArgumentNullException ("document");
+                       }
+
+                       XmlElement element = document.CreateElement ("wsa",
+                                                                    "ReferenceProperties",
+                                                                    "http://schemas.xmlsoap.org/ws/2003/03/addressing");
+                       
+                       GetXmlAny (document, element);
+                       return element;
+               }
+               
+               public void LoadXml (XmlElement element)
+               {
+                       if(element == null) {
+                               throw new ArgumentNullException ("element");
+                       }
+
+                       if(element.LocalName != "ReferenceProperties" || element.NamespaceURI != "http://schemas.xmlsoap.org/ws/2003/03/addressing") {
+                               throw new ArgumentException ("Invalid Element Supplied");
+                       }
+
+                       LoadXmlAny (element);
+               }
+       }
+
+}
diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Addressing/ServiceName.cs b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Addressing/ServiceName.cs
new file mode 100644 (file)
index 0000000..70651ba
--- /dev/null
@@ -0,0 +1,44 @@
+//
+// Microsoft.Web.Services.Addressing.ServiceName.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 ServiceName : AttributedQName, IXmlElement
+       {
+               private string _port;
+
+               public ServiceName (XmlElement element) : base ()
+               {
+                       LoadXml (element);
+               }
+
+               public ServiceName (QualifiedName qname) : base (qname)
+               {
+               }
+
+               [MonoTODO]
+               public XmlElement GetXml (XmlDocument document)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               [MonoTODO]
+               public void LoadXml (XmlElement element)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               public string PortName {
+                       get { return _port; }
+                       set { _port = value; }
+               }
+       }
+}