XMLDA.NET Reference
Read Method
See Also  Example Send Feedback
xmldanet.xmlda Namespace > OpcXmlDA Class : Read Method

Options
Container with options used in most server calls.
ItemList
The container for the individual Items. It is expected that there are one or more Items per ItemList.
RItemList
A container with an arrrya of item elements and their value information. It is expected that there are one or more Item elements per RItemList. The ReadResponse will maintain the Item order in the Read request. If an item is write-only the server will return E_WRITEONLY in the response for this item. The response will provide no value element for the affected item.
Errors
An array of OPCError elements with the description of the errors occured in this server call. Errors are only present if Items contain result codes.

Glossary Item Box

XML-DA method to read a set of item values from an XML-DA or OPC-DA server.

Syntax

Visual Basic (Usage)Copy Code
Dim instance As OpcXmlDA
Dim Options As RequestOptions
Dim ItemList As ReadRequestItemList
Dim RItemList As ReplyItemList
Dim Errors As OPCError()
Dim value As ReplyBase
 
value = instance.Read(Options, ItemList, RItemList, Errors)
C# 
[SoapDocumentMethodAttribute(Action="http://opcfoundation.org/webservices/XMLDA/1.0/Read", 
   RequestNamespace="http://opcfoundation.org/webservices/XMLDA/1.0/", 
   ResponseNamespace="http://opcfoundation.org/webservices/XMLDA/1.0/", 
   Use=SoapBindingUse.Literal, 
   ParameterStyle=SoapParameterStyle.Wrapped)]
public ReplyBase Read( 
   RequestOptions Options,
   ReadRequestItemList ItemList,
   out ReplyItemList RItemList,
   out OPCError[] Errors
)

Parameters

Options
Container with options used in most server calls.
ItemList
The container for the individual Items. It is expected that there are one or more Items per ItemList.
RItemList
A container with an arrrya of item elements and their value information. It is expected that there are one or more Item elements per RItemList. The ReadResponse will maintain the Item order in the Read request. If an item is write-only the server will return E_WRITEONLY in the response for this item. The response will provide no value element for the affected item.
Errors
An array of OPCError elements with the description of the errors occured in this server call. Errors are only present if Items contain result codes.

Return Value

Container of information that represents the basic information for most responses.

Example

Visual BasicCopy Code
Private Sub readValues(ByVal Srv As XmlServer, ByVal itemList As ListBuilder )
      Dim readItemList As ReadRequestItemList
      readItemList = itemList.GetReadItemList( "Read1" )
      Dim reply As ReplyBase
      Dim options As RequestOptions = New RequestOptions
      options.ReturnErrorText = True
      Dim rslt As ReplyItemList
      Dim err As OPCError()
      Try
         reply = Srv.Read(options, readItemList, rslt, err)
         If err Is Nothing Or err.Length = 0 Then  ' no errors
            Dim rItem As ItemValue
            For Each rItem In rslt.Items
               ' handle the read values
            Next
         Else
            MessageBox.Show(err(0).Text, "Error at Write")
         End If
      Catch ex As Exception
         MessageBox.Show(ex.Message, "Exception in Read")
         Close()
      End Try
   End Sub
C#Copy Code
private void readValues( XmlServer Srv, ListBuilder itemList)
      {
         ReadRequestItemList  readItemList ;
         readItemList = itemList.GetReadItemList( "Read1" );
         ReplyBase reply ;
         RequestOptions options = new RequestOptions();
         options.ReturnErrorText = true ;
         ReplyItemList rslt ;
         OPCError[] err ;
         try
         {
            reply = Srv.Read( options, readItemList, out rslt, out err );
            if( (err != null) && (err.Length>0) )
               MessageBox.Show( err[0].Text, "Error at Write" );
            else
            {
               foreach( ItemValue rItem in rslt.Items ) 
               {
                   // handle read values
               }
            }
         }
         catch( Exception ex )
         {
            MessageBox.Show( ex.Message, "Exception in Read" );
            this.Close();
         }
      }

Requirements

Target Platforms:Windows XP Professional, Windows Server 2003 family, Windows Vista, Windows 7, Windows Server 2008 family

>

See Also

© 2002-2012 Advosol Inc. All Rights Reserved.