From: Todd Berman Date: Tue, 7 Oct 2003 23:34:25 +0000 (-0000) Subject: 2003-10-07 Todd Berman X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=commitdiff_plain;h=54fd251e3b604de6f8f2d0908aa0338ad6139a37;p=mono.git 2003-10-07 Todd Berman * ReferenceProperties.cs: Implemented * ServiceName.cs: Partially Implemented * EndpointReferenceType.cs: Implemented * EndpointReference.cs: Implemented svn path=/trunk/mcs/; revision=18725 --- diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Addressing/ChangeLog b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Addressing/ChangeLog index e63335bf8bc..84cc19799a8 100644 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Addressing/ChangeLog +++ b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Addressing/ChangeLog @@ -1,3 +1,10 @@ +2003-10-07 Todd Berman + + * ReferenceProperties.cs: Implemented + * ServiceName.cs: Partially Implemented + * EndpointReferenceType.cs: Implemented + * EndpointReference.cs: Implemented + 2003-10-05 Todd Berman * AddressList.cs: Implemented. diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Addressing/EndpointReference.cs b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Addressing/EndpointReference.cs index 56db486cc4c..95ef664fbae 100644 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Addressing/EndpointReference.cs +++ b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Addressing/EndpointReference.cs @@ -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; } } diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Addressing/EndpointReferenceType.cs b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Addressing/EndpointReferenceType.cs index 1ec81bdb3dc..839dab02141 100644 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Addressing/EndpointReferenceType.cs +++ b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Addressing/EndpointReferenceType.cs @@ -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 index 00000000000..9a3ec1a6f0c --- /dev/null +++ b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Addressing/ReferenceProperties.cs @@ -0,0 +1,54 @@ +// +// Microsoft.Web.Services.Addressing.ReferenceProperties.cs +// +// Author: Todd Berman +// +// (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 index 00000000000..70651ba9b21 --- /dev/null +++ b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Addressing/ServiceName.cs @@ -0,0 +1,44 @@ +// +// Microsoft.Web.Services.Addressing.ServiceName.cs +// +// Author: Todd Berman +// +// (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; } + } + } +}