In laravel5.1-PHP, The functiondoesn' texist problem occurs when using Soap. How can this problem be solved?

Source: Internet
Author: User
New users are using the Laravel framework and xampp to build a background management system. The webservice interface function is required to use soap in php. However, the Functiondoesn & #039; texist problem occurs during the development process and has been stuck for a long time. Therefore, I came to ask for help. The details are as follows: Yes... LaravelFramework and xamppBuild a background management system. The webservice interface function is required to use soap in php. However Function doesn't existSo I came to ask for help. The details are as follows:

There are two PHP files:
① Client. php, used as the soap client
Path:C:\xampp\htdocs\my_project\app\Services\client.php


   "http://localhost/my_project/app/Services/server.php", 'uri' => "http://localhost/", 'encoding' => 'UTF-8'));    echo $client->hello();} catch (SoapFault $fault) {    echo "Error: ", $fault->faultcode, ", String: ", $fault->getMessage();}

② Server. php, used as the soap server
Path:C:\xampp\htdocs\my_project\app\Services\server.php


  "Localhost"); $ soap-> addFunction ('hello'); $ soap-> handle ();} catch (\ SoapFault $ fault) {echo "Error :", $ fault-> faultcode, ", String:", $ fault-> faultstring;} function hello () {$ model = new User; return "hello ";}

Because templates are requiredserver.phpUsednamespace, AndUserClassuse. Howeverserver.phpInSoapServerAndSoapFaultAdd a forward slash\SoapServerAnd\SoapFault

Finally, runC:\xampp\htdocs\my_project\app\Services\client.phpBut it appearsError: SOAP-ENV:Server, String: Function 'hello' doesn't existError message: Baidu Google has never been unsuccessful. I hope experienced predecessors can give me some advice. Thank you very much!

Reply content:

New user, in useLaravelFramework andxamppBuild a background management system. The webservice interface function is required to use soap in php. HoweverFunction doesn't existSo I came to ask for help. The details are as follows:

There are two PHP files:
① Client. php, used as the soap client
Path:C:\xampp\htdocs\my_project\app\Services\client.php


   "http://localhost/my_project/app/Services/server.php", 'uri' => "http://localhost/", 'encoding' => 'UTF-8'));    echo $client->hello();} catch (SoapFault $fault) {    echo "Error: ", $fault->faultcode, ", String: ", $fault->getMessage();}

② Server. php, used as the soap server
Path:C:\xampp\htdocs\my_project\app\Services\server.php


  "Localhost"); $ soap-> addFunction ('hello'); $ soap-> handle ();} catch (\ SoapFault $ fault) {echo "Error :", $ fault-> faultcode, ", String:", $ fault-> faultstring;} function hello () {$ model = new User; return "hello ";}

Because templates are requiredserver.phpUsednamespace, AndUserClassuse. Howeverserver.phpInSoapServerAndSoapFaultAdd a forward slash\SoapServerAnd\SoapFault

Finally, runC:\xampp\htdocs\my_project\app\Services\client.phpBut it appearsError: SOAP-ENV:Server, String: Function 'hello' doesn't existError message: Baidu Google has never been unsuccessful. I hope experienced predecessors can give me some advice. Thank you very much!

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.