Php cannot communicate with WebService. how can this problem be solved?

Source: Internet
Author: User
Tags php write
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();
?>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.