Soap errors are easy.

Source: Internet
Author: User
A simple soap error... always reports the following error: why? Fatal & nbsp; error: & nbsp; Uncaught & nbsp; SoapFault & nbsp; exception: & nbsp; [Client] & nbsp; looks & nbsp; like & nbsp simple soap error...
Always reported errors:
Why?
Fatal error: Uncaught SoapFault exception: [Client] looks like we got no XML document in E: \ xampp \ htdocs \ photowall \ registeraction. php: 22 Stack trace: #0 E: \ xampp \ htdocs \ photowall \ registeraction. php (22): SoapClient->__ call ('test', Array) #1 E: \ xampp \ htdocs \ photowall \ registeraction. php (22): SoapClient-> test () #2 {main} thrown in E: \ xampp \ htdocs \ photowall \ registeraction. php on line 22

The above garbled code is a bit strange... because it appears when I have not output anything ....
I don't know what it means ....
I 'd like to ask you what went wrong...


The following code is used:

A class in usrHelper. php:
 class usrHelper
{
public function test()
{
return "this is a test";
}
}
?>


Server. php is:
 
require_once 'usrHelper.php';

$server = new SoapServer(null, 
array('uri' => "usr_service"));
$server->setClass('usrHelper');
$server->handle();
?>


When calling a service:

$client = new SoapClient(null, array(
      'location' => "http://127.0.0.1/photowall/server.php",
      'uri'      => "usr_service",
      'trace'    => 1 ));
//$client->addUsr($username,$password);
$ans = $client -> test();
echo $ans;

------ Solution --------------------
Do you have no wsdl or asmx files? It seems that you want to provide an xml file.
------ Solution --------------------
After testing, the code you posted has no problems. The result is this is a test.

Observe the error message you posted (this is not garbled) and the error appears in the code related to registeraction. php 22nd,
The code you post is much less.

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.