ContractReference.DocRef Property
Gets and sets the URL for a XML Web service implementing the service description referenced in the Ref property.
[Visual Basic] Public Property DocRef As String [C#] public string DocRef {get; set;} [C++] public: __property String* get_DocRef(); public: __property void set_DocRef(String*); [JScript] public function get DocRef() : String; public function set DocRef(String);
Property Value
The URL for a XML Web service implementing the Service Description referenced in the Ref property.
Remarks
Within a discovery document, a reference to a Service Description is contained within a contractRef XML element. The contractRef XML element has two attributes described in the following table.
| Attribute | Description |
|---|---|
| ref | The URL for the service description. The Ref property represents the value of the ref attribute. |
| docRef | The URL for a XML Web service implementing the service description specified by the ref attribute. The DocRef property represents the value of the docRef attribute. |
Example
[Visual Basic, C#, C++] The following code example sets the DocRef property of ContractReference.
[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) [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); [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);
[JScript] No example is available for JScript. To view a Visual Basic, C#, or C++ example, click the Language Filter button
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 | Ref