A SOAP message consists of the SOAP envelope that contains the SOAP header and the SOAP body, as depicted in figure 11. The SOAP body, where the fieldbus data will be placed, contains XML code which has to comply to the SOAP specification. The SOAP standard constrains this XML code in many ways but leaves the developer many options in choosing suitable XML code for his data. Therefore Fieldbus data may be represented by SOAP messages in various ways.
The format of the SOAP message is specified by a WSDL document, which contains XML Schema code that specifies the format of the SOAP body. In many cases WSDL documents and therefore the whole structure of SOAP messages can be automatically generated by developer frameworks. However, the format of the SOAP message has to be specified in case of standardizing SOAP Web Services, moreover, the format has an impact on the following issues:
Listing 18 shows two SOAP bodies which provide the same functionality. It is obvious that the first body is far less readable than the second.
language=XML
It has to be taken into account that readability comes at a cost - as listing 18 shows, the second SOAP body is a lot larger than the first. Hence there may be cases where a small message size is preferred to readability.
language=XML
Fieldbus data embedded in SOAP messages may be validated by the XML parser. This is accomplished by constraining data by XML Schema, such as assigning specific data types to elements where fieldbus data is stored, such as <display xsi:type = "xsd:string">Sensor1</display>. The huge advantage of this way is that all validations are done by the XML parser, so it is not necessary to create one's own validation algorithms to check the correctness of fieldbus data.