These typecodes can either be created by hand or - in case a WSDL document is available - with a tool, called ``wsdl2py''. This tool generates two python files, which can be imported into custom code and used to access these typecodes. Moreover, the structure of these generated typecodes can then be examined through python, using the ``help()'' command. The idea behind this concept is that a user never has to look at the complicated WSDL code itself, instead he can handle everything through the Python language. Listing 33 depicts a creation of a simple OPC typecode129 and Listing 34 shows the output of the ``help()'' command, while listing 35 shows the regarding snippet of the WSDL document.
Line 5 in Listing 33 depicts how the generated method set_attribute_ClientRequestHandle can be used to fill the associated XML attribute in the SOAP message, as defined in Line 4 in listing 35.
Typecodes may embed other typecodes and hence represent complicated WSDL documents. One huge advantage of this concept is that SOAP-compliant data types are automatically converted to Python-specific data types. For instance, a SOAP ``integer'' will automatically be converted to a Python integer.
The problem with this approach is that complicated WSDL documents generate complicated typecodes, although it may be possible to provide the underlying data in a much simpler form, for instance by creating custom objects, or using specific Python data types, such as dictionaries130. [OPCXMLDA] contains various complicated WSDL structures, which are complex to access. As these structures have to be read/written throughout the whole implementation, a simpler structure would be more appropriate.
After a thorough study of the OPC WSDL document, it was discovered that all request/response documents have one or more OPC Items which transport attributes, such as the Item value, the quality/timestamp and more. OPC Items may contain OPC properties, which contain the name, description and some other attributes of the property. Every request/response is accompanied by general attributes, such as the time when the request was issued, or a deadline until the response must be finished.
Therefore custom and built-in Python objects could be used as follows:
Three basic classes were created that are used for storing SOAP message data into this simpler data structure, as depicted in figure 61131.
These classes have specific ``fill'' and ``read'' methods, which may be used to fill/read suitable ZSI typecodes. These data structures are automatically created by the server, hence the programmer may easily access OPC data of request/response messages and never has to deal with typecodes.