chenall / phalapi-soap

phalapi soap 服务扩展 (PhalApi 2.x)
3 stars 1 forks source link

soap client 使用错误 #1

Open hanfeicode opened 4 years ago

hanfeicode commented 4 years ago

1、 array(3) { ["ret"]=> int(404) ["data"]=> object(stdClass)#2 (0) { } ["msg"]=> string(64) "非法请求:接口服务{"servcie":"Erp.Site.Index"}不存在" }

$data = $client->__soapCall('api',array(json_encode($params))); var_dump($data);

2、 Error: SOAP-ENV:Server, string: Function 'response' doesn't exist $data = $client->__soapCall('response',array(json_encode($params)));

3、严格按照文档来执行的 请问错误在哪

hanfeicode commented 4 years ago

$url = 'http://api.com/soap.php'; // $params = array('servcie' =>'Erp.Site.Index',"username"=>"ssssssbbbbbbbb"); $params = array('servcie' =>'Erp.Site.Index'); try { $client = new SoapClient(null, array( 'location' => $url, 'uri' => $url, ) ); var_dump(json_encode($params)); echo "
"; var_dump(array(json_encode($params))); echo "
"; $data = $client->__soapCall('response',array(json_encode($params))); // $data = $client->__soapCall('api', $params);

//处理返回的数据。。
var_dump($data);

}catch(SoapFault $fault){ echo "Error: ".$fault->faultcode.", string: ".$fault->faultstring; }