XML-DA method to get item properties for a set of items from an XML-DA or OPC-DA server.
Syntax
Visual Basic (Usage) | Copy Code |
---|
Dim instance As OpcXmlDA
Dim ItemIDs() As ItemIdentifier
Dim PropertyNames() As XmlQualifiedName
Dim LocaleID As String
Dim ClientRequestHandle As String
Dim ItemPath As String
Dim ReturnAllProperties As Boolean
Dim ReturnPropertyValues As Boolean
Dim ReturnErrorText As Boolean
Dim PropertyLists As PropertyReplyList()
Dim Errors As OPCError()
Dim value As ReplyBase
value = instance.GetProperties(ItemIDs, PropertyNames, LocaleID, ClientRequestHandle, ItemPath, ReturnAllProperties, ReturnPropertyValues, ReturnErrorText, PropertyLists, Errors) |
C# | |
---|
[SoapDocumentMethodAttribute(Action="http://opcfoundation.org/webservices/XMLDA/1.0/GetProperties",
RequestNamespace="http://opcfoundation.org/webservices/XMLDA/1.0/",
ResponseNamespace="http://opcfoundation.org/webservices/XMLDA/1.0/",
Use=SoapBindingUse.Literal,
ParameterStyle=SoapParameterStyle.Wrapped)]
public ReplyBase GetProperties(
ItemIdentifier[] ItemIDs,
XmlQualifiedName[] PropertyNames,
string LocaleID,
string ClientRequestHandle,
string ItemPath,
bool ReturnAllProperties,
bool ReturnPropertyValues,
bool ReturnErrorText,
out PropertyReplyList[] PropertyLists,
out OPCError[] Errors
) |
Parameters
- ItemIDs
- A list of Items for which to get properties.
ItemPath and ItemName together uniquely identify this element in the server’s browse space. If ItemPath is empty, then ItemName by itself is a fully qualified name that uniquely identifies this element. - PropertyNames
- A sequence of qualified property names to be returned. If ReturnAllProperties is true,
PropertyName is ignored and all properties are returned.
- LocaleID
- An optional value supplied by the client that specifies the language for certain return data
(see section LocaleID in OPC specification).
- ClientRequestHandle
- An optional value supplied by the client that will be returned with the response.
In larger and more complex systems it helps the client to associate the replies with the proper requests.
- ItemPath
- ItemPath is a hierarchical parameter. It can be overridden by the ItemPath in the ItemIdentifier.
If ItemPath is Blank or missing at all levels of the hierarchy, then the ItemName is expected to be a fully qualified name.
- ReturnAllProperties
- Server must return all properties which are available. If ReturnAllProperties is true,
PropertyName is ignored.
- ReturnPropertyValues
- Server must return the property values in addition to the property names.
- ReturnErrorText
- If TRUE the server will return verbose error description.
- PropertyLists
- One of these elements is returned for each requested item.
ItemName and ItemPath are returned for convenience. If unknown or invalid an error is returned in ResultID.
Otherwise, Property contains the list of requested properties. For a detailed description of ItemProperty see the
separate section in the OPC specification.
- Errors
- An array of Errors that is appropriate for this Response.
Return Value
Container of information that represents the basic information for most responses.
Example
Visual Basic | Copy Code |
---|
Private Sub GetProperties(ByVal Srv As XmlServer, ByVal defLists As ListBuilder )
Dim itemListName As String = "GetProperties1"
Dim propListName As String = "Properties Sets"
Dim setName As String = "Set1"
Dim itemList As ItemIdentifier() = defLists.GetPropertiesItemList(itemListName)
If itemList Is Nothing Then
MessageBox.Show("List " & itemListName & " not found in definition file", "Error at get list")
Close()
End If
Dim PropertiesSet As XmlQualifiedName() = defLists.GetPropertiesSet(propListName, setName)
If PropertiesSet Is Nothing Then
MessageBox.Show("List " & propListName & " / " & setName & " not found in file", "Error at get list")
Close()
End If
Try
Dim rslt As PropertyReplyList()
Dim err As OPCError()
' read the set of properties for the defined items
Dim reply As ReplyBase
reply = Srv.GetProperties(itemList, PropertiesSet, Nothing, Nothing, Nothing, False, _
True, True, rslt, err)
' for simplicity handle only one item If Not rslt(0).ResultID Is Nothing Then
MessageBox.Show(rslt(0).ResultID.Name, "Error in Properties of first item")
Else
Dim ip As ItemProperty
For Each ip In rslt(0).Properties
' handle property
Next
End If
Catch ex As Exception
MessageBox.Show(ex.Message, "Exception in GetProperties")
Close()
End Try
End Sub |
C# | Copy Code |
---|
private void GetProperties( XmlServer Srv ) { string itemListName = "GetProperties1" ; string propListName = "Properties Sets" ; string setName = "Set1" ; ItemIdentifier[] ItemList = defLists.GetPropertiesItemList( itemListName ); if( ItemList == null ) { MessageBox.Show( "List " + itemListName + " not found in definition file", "Error at get list" ); Close(); } XmlQualifiedName[] PropertiesSet= defLists.GetPropertiesSet( propListName, setName ); if( PropertiesSet == null ) { MessageBox.Show( "List " + propListName + " / "+ setName + " not found in file", "Error at get list" ); Close(); } try { PropertyReplyList[] rslt ; OPCError[] err; // read the set of properties for the defined items ReplyBase reply = Srv.GetProperties( ItemList, PropertiesSet, null, null, null, false, true, // return values true, // return error text out rslt, out err ); // for simplicity handle only one item if( rslt[0].ResultID != null ) MessageBox.Show( rslt[0].ResultID.Name, "Error in Properties of first item" ); else { this.lvProp.Items.Clear(); foreach( ItemProperty ip in rslt[0].Properties ) // display the item names { // handle property } } } catch( Exception ex ) { MessageBox.Show( ex.Message, "Exception in GetProperties" ); this.Close(); } } |
Requirements
Target Platforms:Windows XP Professional, Windows Server 2003 family, Windows Vista, Windows 7, Windows Server 2008 family
>
See Also