_getFunctions can return null, not only array. This happens if the WSDL has not been parsed yet. This may be helpful to someone debugging, just like I was a few minutes ago when writing an extension to SoapClient.
(PHP 5, PHP 7, PHP 8)
SoapClient::__getFunctions — Returns list of available SOAP functions
Returns an array of functions described in the WSDL for the Web service.
Note:
此函数仅在 WSDL 模式下生效。
此函数没有参数。
The array of SOAP function prototypes, detailing the return type, the function name and parameter types.
Example #1 SoapClient::__getFunctions() example
<?php
$client = new SoapClient('http://soap.amazon.com/schemas3/AmazonWebServices.wsdl');
var_dump($client->__getFunctions());
?>
以上例程会输出:
array(26) { [0]=> string(70) "ProductInfo KeywordSearchRequest(KeywordRequest $KeywordSearchRequest)" [1]=> string(79) "ProductInfo TextStreamSearchRequest(TextStreamRequest $TextStreamSearchRequest)" [2]=> string(64) "ProductInfo PowerSearchRequest(PowerRequest $PowerSearchRequest)" ... [23]=> string(107) "ShoppingCart RemoveShoppingCartItemsRequest(RemoveShoppingCartItemsRequest $RemoveShoppingCartItemsRequest)" [24]=> string(107) "ShoppingCart ModifyShoppingCartItemsRequest(ModifyShoppingCartItemsRequest $ModifyShoppingCartItemsRequest)" [25]=> string(118) "GetTransactionDetailsResponse GetTransactionDetailsRequest(GetTransactionDetailsRequest $GetTransactionDetailsRequest)" }
_getFunctions can return null, not only array. This happens if the WSDL has not been parsed yet. This may be helpful to someone debugging, just like I was a few minutes ago when writing an extension to SoapClient.
The following code works for me while it appears soap.amazon.com has been deprecated and taken out of service. http://webservices.amazon.com has replaced Amazon's SOAP.
<?php
$client = new SoapClient('http://webservices.amazon.com/AWSECommerceService/AWSECommerceService.wsdl');
var_dump($client->__getFunctions());
?>
This function did not work if schema is not in wsdl file.