1,php soap客户端代码,如下:
<?php try { $client = new SoapClient( null, array('location' =>'http://localhost/oms07/index.php?r=api', 'uri' =>'http://localhost/oms07') ); $results = $client->__soapCall('getFailParts', array('startTime'=>'2013-10-24','endTime'=>'2013-10-25')); var_dump($result); } catch (Exception $e) { printf("Message = %s",$e->__toString()); }
2,调试
php soap扩展提供的调试功能,演示代码:
<?php /** * 设置参数array("trace"=>true)用于调试 * __getLastRequest 返回请求信息 * __getLastResponse 返回响应信息包括报错信息都会返回 */ try{ $client = new SoapClient($server,array("trace"=>true)); $client->method($args); }catch(SoapFault $e){ echo $client->__getLastRequest(); echo $client->__getLastResponse(); echo $e->getMessage(); }