This documentation is archived and is not being maintained.

ContractReference.Namespace Field

XML namespace for service description references in discovery documents.

[Visual Basic]
Public Const Namespace As String
[C#]
public const string Namespace;
[C++]
public: const String* Namespace;
[JScript]
public var Namespace : String;

Remarks

Within a discovery document, a reference to a Service Description is contained within a contractRef XML element, which is a part of the XML namespace specified in the Namespace constant.

Example

[Visual Basic, C#, C++] The following code example outputs to the console the value of the Namespace constant.

[Visual Basic] 
' Call the Constructor of ContractReference.
Dim myContractReference As New ContractReference()
Dim myXmlDocument As New XmlDocument()

' Read the discovery document for the 'contractRef' tag.
myXmlDocument.Load("http://localhost/Discoverydoc.disco")

Dim myXmlRoot As XmlNode = myXmlDocument.FirstChild
Dim myXmlNode As XmlNode = myXmlRoot("scl:contractRef")
Dim myAttributeCollection As XmlAttributeCollection = myXmlNode.Attributes

myContractReference.Ref = myAttributeCollection(0).Value
Console.WriteLine("The URL to the referenced service description is : {0}", myContractReference.Ref)
myContractReference.DocRef = myAttributeCollection(1).Value
Console.WriteLine("The URL implementing the referenced service description is : {0}", myContractReference.DocRef)
Console.WriteLine("Namespace for the referenced service description is : {0}", ContractReference.Namespace)

[C#] 
// Call the Constructor of ContractReference.
ContractReference myContractReference = new ContractReference();
XmlDocument myXmlDocument = new XmlDocument();

// Read the discovery document for the 'contractRef' tag.
myXmlDocument.Load("http://localhost/Discoverydoc.disco");
   
XmlNode myXmlRoot = myXmlDocument.FirstChild;
XmlNode myXmlNode = myXmlRoot["scl:contractRef"]; 
XmlAttributeCollection myAttributeCollection = myXmlNode.Attributes;

myContractReference.Ref = myAttributeCollection[0].Value;
Console.WriteLine("The URL to the referenced service description is : {0}",myContractReference.Ref);
myContractReference.DocRef = myAttributeCollection[1].Value;
Console.WriteLine("The URL implementing the referenced service description is : {0}",myContractReference.DocRef);
Console.WriteLine("Namespace for the referenced service description is : {0}", ContractReference.Namespace);

[C++] 
// Call the Constructor of ContractReference.
ContractReference* myContractReference = new ContractReference();
XmlDocument* myXmlDocument = new XmlDocument();

// Read the discovery document for the 'contractRef' tag.
myXmlDocument -> Load(S"http://localhost/Discoverydoc.disco");

XmlNode * myXmlRoot = myXmlDocument -> FirstChild;
XmlNode * myXmlNode = myXmlRoot->Item[S"scl:contractRef"]; 
XmlAttributeCollection * myAttributeCollection = myXmlNode -> Attributes;

myContractReference->Ref = myAttributeCollection->ItemOf[0]->Value; 
Console::WriteLine(S"The URL to the referenced service description is : {0}", myContractReference -> Ref);
myContractReference -> DocRef = myAttributeCollection->ItemOf[1]->Value;
Console::WriteLine(S"The URL implementing the referenced service description is : {0}", myContractReference -> DocRef);
Console::WriteLine(S"Namespace for the referenced service description is : {0}", ContractReference::Namespace);

[JScript] No example is available for JScript. To view a Visual Basic, C#, or C++ example, click the Language Filter button Language Filter in the upper-left corner of the page.

Requirements

Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family

See Also

ContractReference Class | ContractReference Members | System.Web.Services.Discovery Namespace

Show: