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

Options
Container with options used in most server calls.
ServerSubHandles
Supplied by the Server in the SubscribeResponse, it is used by the server to identify the Subscription to be polled. Multiple ServerSubHandles may be supplied. The server will respond with the changes in data associated with all supplied ServerSubHandles. The Server will maintain the order of Items within each polled subscription list, and for subscriptions in the response (relative to the ServerSubHandles) – even if some subscriptions or some items in the subscriptions are missing.
HoldTime
Instructs the server to hold off returning from the refresh service call until the absolute time of the server is equal or greater than this value.
HoldTimeSpecified
If FALSE then the HoldTime argument is ignored.
WaitTime
Instructs the server to wait the specified number of milliseconds after HoldTime before returning if there are no changes to report. A change in one of the subscribed items, during this wait period, will result in the service returning immediately rather than completing the wait time.
ReturnAllItems
If set to FALSE, then the server will return only the changed Items between this SubscriptionPolledRefresh request and the previous request.
If TRUE the server will return all Items specified by the original Subscribe. The server will wait the HoldTime but then return with all current values (and any buffered values if EnableBuffering) ignoring the change status of the items. That is the WaitTime is not considered under this condition
InvalidServerSubHandles
The server will identify 0 or more ServerSubHandles that were invalid.
RItemList
One RItemList for each subscription of which items have to be returned.
A RItemList for each polled (and valid) subscription handle is sent if the client requested them with “ReturnAllItems”. If “ReturnAllItems” is FALSE, the server only returns Items which had changed. Each RItemList contains the SubscriptionHandle. Within each list the Items will be returned in a relative order based on their relative order in the original Subscribe even if some of the Items are missing because the values have not changed. If there are no values which have changed, the server will respond with a response without any RItemList.
If EnableBuffering = False then the server will send only the latest value that it is maintaining for those changed items.
If EnableBuffering = True then the server will send all value changes (Last Changed Value and any buffered values) for those changed items since the last SubscriptionPolledRefresh.
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.
DataBufferOverflow
individual items occurred, but not all of these changes could be buffered due to resource limitations. The server is required to provide at least the most recent change for each item that changed since the last update. The individual items will indicate whether they were impacted by this resource limitation. For more details on buffering see the section on Buffered Data and the OPC DA Custom Specification for additional details on this topic.

Glossary Item Box

XML-DA method to poll subscribed items from either an XML-DA or OPC-DA server.

Syntax

Visual Basic (Usage)Copy Code
Dim instance As OpcXmlDA
Dim Options As RequestOptions
Dim ServerSubHandles() As String
Dim HoldTime As Date
Dim HoldTimeSpecified As Boolean
Dim WaitTime As Integer
Dim ReturnAllItems As Boolean
Dim InvalidServerSubHandles As String()
Dim RItemList As SubscribePolledRefreshReplyItemList()
Dim Errors As OPCError()
Dim DataBufferOverflow As Boolean
Dim value As ReplyBase
 
value = instance.SubscriptionPolledRefresh(Options, ServerSubHandles, HoldTime, HoldTimeSpecified, WaitTime, ReturnAllItems, InvalidServerSubHandles, RItemList, Errors, DataBufferOverflow)
C# 
[SoapDocumentMethodAttribute(Action="http://opcfoundation.org/webservices/XMLDA/1.0/SubscriptionPolledRefresh", 
   RequestNamespace="http://opcfoundation.org/webservices/XMLDA/1.0/", 
   ResponseNamespace="http://opcfoundation.org/webservices/XMLDA/1.0/", 
   Use=SoapBindingUse.Literal, 
   ParameterStyle=SoapParameterStyle.Wrapped)]
public ReplyBase SubscriptionPolledRefresh( 
   RequestOptions Options,
   string[] ServerSubHandles,
   DateTime HoldTime,
   bool HoldTimeSpecified,
   int WaitTime,
   bool ReturnAllItems,
   out string[] InvalidServerSubHandles,
   out SubscribePolledRefreshReplyItemList[] RItemList,
   out OPCError[] Errors,
   out bool DataBufferOverflow
)

Parameters

Options
Container with options used in most server calls.
ServerSubHandles
Supplied by the Server in the SubscribeResponse, it is used by the server to identify the Subscription to be polled. Multiple ServerSubHandles may be supplied. The server will respond with the changes in data associated with all supplied ServerSubHandles. The Server will maintain the order of Items within each polled subscription list, and for subscriptions in the response (relative to the ServerSubHandles) – even if some subscriptions or some items in the subscriptions are missing.
HoldTime
Instructs the server to hold off returning from the refresh service call until the absolute time of the server is equal or greater than this value.
HoldTimeSpecified
If FALSE then the HoldTime argument is ignored.
WaitTime
Instructs the server to wait the specified number of milliseconds after HoldTime before returning if there are no changes to report. A change in one of the subscribed items, during this wait period, will result in the service returning immediately rather than completing the wait time.
ReturnAllItems
If set to FALSE, then the server will return only the changed Items between this SubscriptionPolledRefresh request and the previous request.
If TRUE the server will return all Items specified by the original Subscribe. The server will wait the HoldTime but then return with all current values (and any buffered values if EnableBuffering) ignoring the change status of the items. That is the WaitTime is not considered under this condition
InvalidServerSubHandles
The server will identify 0 or more ServerSubHandles that were invalid.
RItemList
One RItemList for each subscription of which items have to be returned.
A RItemList for each polled (and valid) subscription handle is sent if the client requested them with “ReturnAllItems”. If “ReturnAllItems” is FALSE, the server only returns Items which had changed. Each RItemList contains the SubscriptionHandle. Within each list the Items will be returned in a relative order based on their relative order in the original Subscribe even if some of the Items are missing because the values have not changed. If there are no values which have changed, the server will respond with a response without any RItemList.
If EnableBuffering = False then the server will send only the latest value that it is maintaining for those changed items.
If EnableBuffering = True then the server will send all value changes (Last Changed Value and any buffered values) for those changed items since the last SubscriptionPolledRefresh.
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.
DataBufferOverflow
individual items occurred, but not all of these changes could be buffered due to resource limitations. The server is required to provide at least the most recent change for each item that changed since the last update. The individual items will indicate whether they were impacted by this resource limitation. For more details on buffering see the section on Buffered Data and the OPC DA Custom Specification for additional details on this topic.

Return Value

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

Example

Visual BasicCopy Code
Public Sub PollThread()

      Dim Srv As XmlServer = New XmlServer(cbURL.Text)
      While Not pollTermiateRequest                 ' periodic refresh loop

         ' request the refresh in Sync mode
         Dim rOpt As RequestOptions = New RequestOptions
         Dim SubscrHnds(0) As String
         SubscrHnds(0) = srvHandle
         Dim invalidHandles As String()
         Dim rslt As SubscribePolledRefreshReplyItemList()
         Dim Err As OPCError()
         Dim overflow As Boolean
         Dim rep As ReplyBase
         Try
            rep = Srv.SubscriptionPolledRefresh(rOpt, SubscrHnds, DateTime.MinValue, False, 5000, True, _
                                                 invalidHandles, rslt, Err, overflow)
            If Not Err Is Nothing Then
               If Err.Length > 0 Then
                  MessageBox.Show(Err(0).Text, "Exception in Poll")
                  Return                 ' abort thread
               End If
            End If
            Dim rItem As ItemValue
            For Each rItem In rslt(0).Items       ' for simplicity only one subscription
                ' handle the item value
            Next
         Catch ex As Exception
            MessageBox.Show(ex.Message, "Exception in Poll")
            Return                 ' abort thread
         End Try

         Thread.Sleep(2000)
      End While
   End Sub
C#Copy Code
public void PollThread(  )
      {
         XmlServer Srv = new XmlServer( cbURL.Text );
         while( ! pollTermiateRequest  )                // periodic refresh loop
         {
            // request the refresh in Sync mode
            RequestOptions rOpt = new RequestOptions();
            string[] SubscrHnds = new string[ 1 ] ;
            SubscrHnds[0] = srvHandle ;
            string[] invalidHandles;
            SubscribePolledRefreshReplyItemList[] rslt ;
            OPCError[] err ;
            bool overflow ;
            ReplyBase rep;
            try
            {
               rep = Srv.SubscriptionPolledRefresh( rOpt, SubscrHnds, DateTime.MinValue, false, 5000, true, 
                                                                out invalidHandles, out rslt, out err, out overflow );         
               if( (err != null) && (err.Length>0) )
               {
                  MessageBox.Show( err[0].Text, "Exception in Poll" );
                  return ;                // abort thread
               }
               foreach( ItemValue rItem in rslt[0].Items )     // for simplicity only one subscription
               {
                  // handle the item values
               }
            }
            catch( Exception ex )
            {
               MessageBox.Show( ex.Message, "Exception in Poll" );
               return ;                // abort thread
            }
            Thread.Sleep( 2000 );
         }
      }

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.