From: Todd Berman Date: Thu, 9 Oct 2003 04:44:36 +0000 (-0000) Subject: 2003-10-08 Todd Berman X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=commitdiff_plain;h=d5a9d5c7f80c92e587be96b75a34093c6afe54ba;p=mono.git 2003-10-08 Todd Berman * RelatesTo.cs: Implemented * ReplyTo.cs: Implemented * To.cs: Implemented svn path=/trunk/mcs/; revision=18791 --- 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 ff0b0b23962..82749a6e323 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,9 @@ +2003-10-08 Todd Berman + + * RelatesTo.cs: Implemented + * ReplyTo.cs: Implemented + * To.cs: Implemented + 2003-10-08 Todd Berman * 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 index 00000000000..80fec335361 --- /dev/null +++ b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Addressing/RelatesTo.cs @@ -0,0 +1,101 @@ +// +// Microsoft.Web.Services.Addressing.RelatesTo.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 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; + } + } +} diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Addressing/ReplyTo.cs b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Addressing/ReplyTo.cs index c0c80bde691..732250ad6fa 100644 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Addressing/ReplyTo.cs +++ b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Addressing/ReplyTo.cs @@ -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; } } diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Addressing/To.cs b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Addressing/To.cs index 64c61a12e0c..dacae94ad08 100644 --- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Addressing/To.cs +++ b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Addressing/To.cs @@ -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; } }