Handling Complex Types (Windows Embedded CE 6.0)
1/6/2010
The server supports operations that use simple data types.
As shown in the following code example from the Web Services Description Language (WSDL) file from the Calc sample application, the server supports the Add and Subtract methods. The Add method takes parameters that each map to the XML Schema Definition (XSD) double type.
...
<message name='Calc.Add'>
<part name='A' type='xsd:double'/>
<part name='B' type='xsd:double'/>
</message>
<message name='Calc.AddResponse'>
<part name='Result' type='xsd:double'/>
</message>
...
When building SOAP messages that request these operations, the SoapClient and SoapServer objects in the SOAP Toolkit for Windows Embedded CE know how to map these XSD base types to XML. For example, the double type maps to text and the string type maps to text.
Use the ISoapClient and ISoapServer interfaces to access the SoapClient and SoapServer objects.
If you are sending complex types in a SOAP message, the SoapClient and SoapServer objects do not know how to map these types to XML.
An example of a complex type is found in the following sample WSDL fragment.
This example specifies a GetAddr operation whose parameter is a complex type named Addr. What makes Addr a complex type is the fact that this object consists of multiple string types instead of a single data type.
...
<types>
<schema targetNamespace='http://tempuri.org/type'
xmlns='http://www.w3.org/2001/XMLSchema'
xmlns:SOAP-ENC='https://schemas.xmlsoap.org/soap/encoding/'
xmlns:wsdl='https://schemas.xmlsoap.org/wsdl/'
elementFormDefault='qualified'>
<complexType name="Addr">
<sequence>
<element name='name' type='string'/>
<element name='street' type='string'/>
<element name='city' type='string'/>
<element name='state' type='string'/>
<element name='zip-code' type='string'/>
</sequence>
</complexType>
</schema>
</types>
...
<message name='AddrBook.GetAddr'>
<part name='Name' type='xsd:string'/>
</message>
<message name='AddrBook.GetAddrResponse'>
<part name='Result' type='typens:Addr'/>
</message>
...
To send complex types in a SOAP message using a high-level API, implement a custom mapper, as described in Sending Complex Types Using a Custom Type Mapper.
If you plan on sending complex types using a low-level API, you might want to use the built-in type mappers provided with the toolkit to properly serialize and deserialize simple types and arrays. For more information, see ISoapTypeMapperFactory.
See Also
Reference
ISoapTypeMapper
ISoapTypeMapperFactory