PHP如何调用webservice
SOAP的WebService是可以直接使用的,php有支持SoapClient的,用起来很容易优质内容筛选与推荐>>
<?php
$wsdl = "http://192.168.1.2/jaxws/services/test?wsdl";
$client = new SoapClient($wsdl);
$param = array('arg0'=>'arg0','arg1'=>'arg1');
$ret = $client->getUserinfoByID($param);
if ($ret->return){
print_r($ret->return);
}else{
echo 'no user';
}
具体SoapClient需要php的soap支持,看phpinfo里有soap的话就可以了,比如这样:
soap
Soap Client enabled
Soap Server enabled
Directive Local Value Master Value
soap.wsdl_cache 1 1
soap.wsdl_cache_dir /tmp /tmp
soap.wsdl_cache_enabled 1 1
soap.wsdl_cache_limit 5 5
soap.wsdl_cache_ttl 86400 86400