next up previous contents
Next: Global OPC XML-DA options Up: Architecture and Basic Concepts Previous: Basic PyOPC Architecture   Contents

Representation of OPC XML-DA Data with Python Objects

As already mentioned, handling SOAP messages with ZSI is not simple. Therefore specific objects are defined by PyOPC which can be easily accessed and represent the corresponding SOAP messages.

OPC XML-DA compliant SOAP messages contain various options which may either concern the whole operation (global options) or may be item specific (local options). After closely examining these messages, it was found that these options can be mapped to two certain Python objects as depicted in figure 4.

Figure 4: Python Objects Representing OPC XML-DA Messages
\begin{figure}\centering
\includegraphics[scale=0.7]{graphics/message_basic.eps}\end{figure}

These two Python objects are the basic containers in the PyOPC framework and are used to transport OPC data. Therefore they are used as parameters for methods which represent OPC XML-DA operations. Listing 2 shows an example of an OPC XML-DA read operation.

language=C
\begin{lstlisting}[caption={Usage of Python objects for representing
global and ...
...em_list,global_options = xda.Read([item], ItemPath='test_path')
\end{lstlisting}

In line 1, an ItemContainer object is created, which contains the item specific (local) options ``ItemName'' and ``MaxAge''. In line 2 the read operation is taking place, with a list of ItemContainer objects as the first parameter and the global option ``ItemPath'' as the second. The results of the read operation also consist of a list of ItemContainer objects and a Python dictionary, containing the local and global options.

Global and local options may sometimes be the same. In this case, the local options override the global ones. For instance, if the option ``ItemPath'' is specified globally and locally, the local, item specific ItemPath will have precedence.

As this mechanism is the same for all operations, it is sometimes possible to set options that have no meaning for the current operation. However, only relevant options will be included in the resulting SOAP message, other options are ignored by the PyOPC framework. For instance, setting the option ``MaxAge'' for an OPC Write operation has no effect at all.

There are a number of options that can be set for OPC XML-DA operations, which can be looked up in [OPCXMLDA]. These options are case sensitive, for instance ``MaxAge'' and ``maxage'' are handled as a different option.



Subsections
next up previous contents
Next: Global OPC XML-DA options Up: Architecture and Basic Concepts Previous: Basic PyOPC Architecture   Contents
Hermann Himmelbauer 2006-11-07