Php cannot write the client code for WebService communication: & lt ;? Php & nbsp; $ client & nbsp; new & nbsp; SoapClient (null, & nbsp; array (location & gt; 192.168.1.100testserverSoap.php, uri & php write WebService cannot communicate
Client code:
$client = new SoapClient(null, array('location'=>"http://192.168.1.100/test/serverSoap.php",'uri' =>"http://soap/"));
echo $client->show();
?>
Server code:
class test{
function show(){
return 'the data you request';
}
}
function getUserInfo($name){
return 'fbbin';
}
$soap = new SoapServer(null, array('uri'=>'http://soap/','location'=>'http://localhost/test/serverSoap.php'));
$server->serClass('test');
$server->handle();
?>
The wamp used in the running environment is stored in the www/test/directory of the wamp installation directory.
Operating system window 8
Open a browser to access client files
Http: // localhost/test/serverClient. php
The error message is shown as follows:
I am a newbie. I just learned php for a few days. webservice only knows what to do and has never used it. Can you tell me more about it? thank you for your answers.
Php soap service to open.
Php soap service to enable:
------ Solution --------------------
So careless.
class test{
function show(){
return 'the data you request';
}
}
function getUserInfo($name){
return 'fbbin';
}
$server = new SoapServer(null, array('uri'=>'http://soap/','location'=>'http://localhost/test/serverSoap.php'));
$server->setClass('test');
$server->handle();
?>
------ Solution --------------------
Supplement
class test{
function show(){
return 'the data you request';
}
function getUserInfo($name){
return 'fbbin';
}
}
$server = new SoapServer(null, array('uri'=>'http://soap/','location'=>'http://localhost/test/serverSoap.php'));
$server->setClass('test');
$server->handle();
?>