Zend_Soap WSDL accessor implementation uses the following type
mapping between PHP and SOAP types:
PHP strings <->
xsd:string.PHP integers <->
xsd:int.PHP floats and doubles <->
xsd:float.PHP booleans <->
xsd:boolean.PHP arrays <->
soap-enc:Array.PHP object <->
xsd:struct.PHP class <-> based on complex type strategy (See: this section) [28].
PHP void <-> empty type.
If type is not matched to any of these types by some reason, then
xsd:anyTypeis used.
Where xsd: is "http://www.w3.org/2001/XMLSchema" namespace,
soap-enc: is a "http://schemas.xmlsoap.org/soap/encoding/" namespace,
tns: is a "target namespace" for a service.
getType($type) method may be used to get mapping for a
specified PHP type:
<?php
...
$wsdl = new Zend_Soap_Wsdl('My_Web_Service', $myWebServiceUri);
...
$soapIntType = $wsdl->getType('int');
...
class MyClass {
...
}
...
$soapMyClassType = $wsdl->getType('MyClass');
addComplexType($type) method is used to add complex types
(PHP classes) to a WSDL document.
It's automatically used by getType() method to add
corresponding complex types of method parameters or return types.
Its detection and building algorithm is based on the currently active detection
strategy for complex types. You can set the detection strategy either by specifying
the class name as string or instance of a
Zend_Soap_Wsdl_Strategy_Interface implementation as the third
parameter of the constructor or using the
setComplexTypeStrategy($strategy) function of
Zend_Soap_Wsdl. The following detection strategies currently
exist:
Class
Zend_Soap_Wsdl_Strategy_DefaultComplexType: Enabled by default (when no third constructor parameter is set). Iterates over the public attributes of a class type and registers them as subtypes of the complex object type.Class
Zend_Soap_Wsdl_Strategy_AnyType: Casts all complex types into the simple XSD type xsd:anyType. Be careful this shortcut for complex type detection can probably only be handled successfully by weakly typed languages such as PHP.Class
Zend_Soap_Wsdl_Strategy_ArrayOfTypeSequence: This strategy allows to specify return parameters of the type:int[]orstring[]. As of Zend Framework version 1.9 it can handle both simple PHP types such as int, string, boolean, float aswell as objects and arrays of objects.Class
Zend_Soap_Wsdl_Strategy_ArrayOfTypeComplex: This strategy allows to detect very complex arrays of objects. Objects types are detected based on theZend_Soap_Wsdl_Strategy_DefaultComplexTypeand an array is wrapped around that definition.Class
Zend_Soap_Wsdl_Strategy_Composite: This strategy can combine all strategies by connecting PHP Complex types (Classnames) to the desired strategy via theconnectTypeToStrategy($type, $strategy)method. A complete typemap can be given to the constructor as an array with$type->$strategypairs. The second parameter specifies the default strategy that will be used if an unknown type is requested for adding. This parameter defaults to theZend_Soap_Wsdl_Strategy_DefaultComplexTypestrategy.
addComplexType() method creates
'/definitions/types/xsd:schema/xsd:complexType' element for
each described complex type with name of the specified PHP class.
Class property MUST have docblock section with the described PHP type to have property included into WSDL description.
addComplexType() checks if type is already described within
types section of the WSDL document.
It prevents duplications if this method is called two or more times and recursion in the types definition section.
See http://www.w3.org/TR/wsdl#_types for the details.
[28]
By default Zend_Soap_Wsdl will be created
with the
Zend_Soap_Wsdl_Strategy_DefaultComplexType
class as detection algorithm for complex types. The first parameter
of the AutoDiscover constructor takes any complex type strategy
implementing
Zend_Soap_Wsdl_Strategy_Interface or a string
with the name of the class. For backwards compatibility with
$extractComplexType boolean variables are parsed
the following way: If TRUE,
Zend_Soap_Wsdl_Strategy_DefaultComplexType,
if FALSE
Zend_Soap_Wsdl_Strategy_AnyType.




