# 使用SoapClient 需要打开扩展,PHP-soap,还有openssl;
#创建对象的时候,因为参数问题一直报错: SOAP-ERROR: Parsing WSDL:Couldn’t load from “xxxxxxx”
$context = stream_context_create(array(
'ssl' => array('verify_peer' => false, 'verify_peer_name' => false, 'allow_self_signed' => true)
));
$requestUrl = '请求的wsdl';
try {
$client = new SoapClient($requestUrl,
array(
'trace' => 1,
'cache_wsdl' => WSDL_CACHE_NONE,
'features' => SOAP_SINGLE_ELEMENT_ARRAYS,
'stream_context' => $context
)
);
print "\n提供的方法\n";
print_r($client->__getFunctions());
print "相关的数据结构\n";
print_r($client->__getTypes());
print "\n\n";
} catch (SoapFault $exception) {
echo "Problem..... : ";
echo $exception;
}
$param = array('arg0' => 'arg0', 'arg1' => 'arg1');
$ret = $client->CheckBalance($param);
echo '
';
var_dump($ret);
if ($ret->return) {
print_r($ret->return);
} else {
echo 'no user';
}
die;