function wsclient_soap_parse_types in Web service client 7
Convert metadata about data types provided by a SOAPClient into a wsclient compatible data type array.
Parameters
array $types: The array containing the struct strings.
Return value
A data type array with property information.
1 call to wsclient_soap_parse_types()
- WSClientSOAPEndpoint::initializeMetadata in wsclient_soap/
wsclient_soap.module - Retrieve metadata from the WSDL about available data types and operations.
File
- wsclient_soap/
wsclient_soap.module, line 236 - Web service client SOAP support.
Code
function wsclient_soap_parse_types(array $types) {
$wsclient_types = array();
foreach ($types as $type_string) {
if (strpos($type_string, 'struct') === 0) {
$parts = explode('{', $type_string);
// Cut off struct and whitespaces from type name.
$type_name = trim(substr($parts[0], 6));
$wsclient_types[$type_name] = array(
'label' => $type_name,
);
$property_string = $parts[1];
// Cut off trailing '}'
$property_string = substr($property_string, 0, -1);
$properties = explode(';', $property_string);
// Remove last empty element
array_pop($properties);
// Initialize empty property information.
$wsclient_types[$type_name]['property info'] = array();
foreach ($properties as $property_string) {
// Cut off white spaces.
$property_string = trim($property_string);
$parts = explode(' ', $property_string);
$property_type = $parts[0];
$property_name = $parts[1];
$wsclient_types[$type_name]['property info'][$property_name] = array(
'type' => wsclient_soap_type_mapper($property_type),
);
}
}
}
return $wsclient_types;
}