**** Merged from MCS ****
[mono-project.git] / mcs / class / Microsoft.Web.Services / Microsoft.Web.Services.Addressing / EndpointReference.cs
blobb91d7fe4d26150d3a7dadbb010ff13a9cfd9da3b
1 //
2 // Microsoft.Web.Services.Addressing.EndpointReference
3 //
4 // Author: Todd Berman <tberman@gentoo.org>
5 //
6 // (C) 2003 Todd Berman
8 using System;
9 using System.Xml;
10 using Microsoft.Web.Services.Xml;
12 namespace Microsoft.Web.Services.Addressing
15 public class EndpointReference : EndpointReferenceType, IXmlElement
18 public EndpointReference (Address address) : base (address)
22 public EndpointReference (Uri uri) : base (uri)
26 public EndpointReference (XmlElement element) : base ()
28 LoadXml (element);
31 public XmlElement GetXml (XmlDocument document)
33 if(document == null) {
34 throw new ArgumentNullException ("document");
36 XmlElement element = document.CreateElement ("wsa",
37 "EndpointReference",
38 "http://schemas.xmlsoap.org/ws/2003/03/addressing");
40 GetXmlAny (document, element);
41 return element;
44 public void LoadXml (XmlElement element)
46 if(element == null) {
47 throw new ArgumentNullException ("element");
49 if(element.LocalName != "EndpointReference" || element.NamespaceURI != "http://schemas.xmlsoap.org/ws/2003/03/addressing") {
50 throw new ArgumentException ("Invalid Element Supplied");
52 LoadXmlAny (element);
55 public static implicit operator EndpointReference (Uri uri)
57 return new EndpointReference (uri);
60 public static implicit operator Uri (EndpointReference obj)
62 if(obj == null) {
63 return null;
65 return obj.Address.Value;