PHP 7.0.6 Released

SoapClient::__getTypes

(PHP 5 >= 5.0.1, PHP 7)

SoapClient::__getTypesReturns a list of SOAP types

Description

public array SoapClient::__getTypes ( void )

Returns an array of types described in the WSDL for the Web service.

Note:

This function only works in WSDL mode.

Parameters

This function has no parameters.

Return Values

The array of SOAP types, detailing all structures and types.

Examples

Example #1 SoapClient::__getTypes() example

<?php
$client 
= new SoapClient('http://soap.amazon.com/schemas3/AmazonWebServices.wsdl');
var_dump($client->__getTypes());
?>

The above example will output:

array(88) {
  [0]=>
  string(30) "ProductLine ProductLineArray[]"
  [1]=>
  string(85) "struct ProductLine {
 string Mode;
 string RelevanceRank;
 ProductInfo ProductInfo;
}"
  [2]=>
  string(105) "struct ProductInfo {
 string TotalResults;
 string TotalPages;
 string ListName;
 DetailsArray Details;
}"
...
  [85]=>
  string(32) "ShortSummary ShortSummaryArray[]"
  [86]=>
  string(121) "struct GetTransactionDetailsRequest {
 string tag;
 string devtag;
 string key;
 OrderIdArray OrderIds;
 string locale;
}"
  [87]=>
  string(75) "struct GetTransactionDetailsResponse {
 ShortSummaryArray ShortSummaries;
}"
}

See Also

User Contributed Notes

felipe dot cwb at hotmail dot com
1 year ago
<?php
// to see formated types

$soap = new SoapClient('http://domain.com/ws.php?WSDL');

echo
'<pre>';
echo
'<h2>Types:</h2>';
$types = $soap->__getTypes();
foreach (
$types as $type) {
   
$type = preg_replace(
        array(
'/(\w+) ([a-zA-Z0-9]+)/', '/\n /'),
        array(
'<font color="green">${1}</font> <font color="blue">${2}</font>', "\n\t"),
       
$type
   
);
    echo
$type;
    echo
"\n\n";
}
echo
'</pre>';
sanok
1 year ago
Great snippet Felipe!

Thank you very much, very useful!
To Top