--- /dev/null
+//
+// 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;
+ }
+ }
+}
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;
}
}
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;
}
}