Rumah > Artikel > pembangunan bahagian belakang > php写WebService无法通信,该怎么解决
php写WebService无法通信
客户端代码:
<br /><?php<br /> $client = new SoapClient(null, array('location'=>"http://192.168.1.100/test/serverSoap.php",'uri' =>"http://soap/"));<br /> echo $client->show(); <br />?><br />
<br /><?php<br /> class test{<br /> function show(){<br /> return 'the data you request';<br /> }<br /> }<br /> function getUserInfo($name){<br /> return 'fbbin';<br /> }<br /> $soap = new SoapServer(null, array('uri'=>'http://soap/','location'=>'http://localhost/test/serverSoap.php'));<br /> $server->serClass('test');<br /> $server->handle();<br />?><br />
<?php<br /> class test{<br /> function show(){<br /> return 'the data you request';<br /> }<br /> }<br /> function getUserInfo($name){<br /> return 'fbbin';<br /> }<br /> $server = new SoapServer(null, array('uri'=>'http://soap/','location'=>'http://localhost/test/serverSoap.php'));<br /> $server->setClass('test');<br /> $server->handle();<br />?>
<br /><?php<br /> class test{<br /> function show(){<br /> return 'the data you request';<br /> }<br /><br /> function getUserInfo($name){<br /> return 'fbbin';<br /> }<br /> }<br /> $server = new SoapServer(null, array('uri'=>'http://soap/','location'=>'http://localhost/test/serverSoap.php'));<br /> $server->setClass('test');<br /> $server->handle();<br />?><br />