In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/02 Report--
How to start Web Service, in view of this problem, this article introduces the corresponding analysis and solutions in detail, hoping to help more partners who want to solve this problem to find a more simple and feasible way.
Reading Web Services makes your application a Web application. Web Services is published, found, and used through Web.
Example
Before starting the instance, we need to determine whether PHP has the SOAP extension installed. Looking at phpinfo, the following message appears to indicate that the SOAP extension has been installed:
In this example, we will use PHP SOAP to create a simple Web Service.
Server side
The Server.php file code is as follows:
/ / the SiteInfo class is used to process requests Class SiteInfo {/ * return website name * @ return string * * / public function getName () {return "Linux should learn";} public function getUrl () {return "www.linuxprobe.com" }} / / create the SoapServer object $s = new SoapServer (null,array ("location" = > "http://localhost/soap/Server.php","uri"=>"Server.php"));// exports all functions in the SiteInfo class $s-> setClass (" SiteInfo "); / / process an SOAP request, call the necessary functions, and send back a response. $s-> handle ()
Client
The Client.php file code is as follows:
Try {/ / non-wsdl calls web service / / create SoapClient object $soap = new SoapClient (null,array ('location'= > "http://localhost/soap/Server.php",'uri'=>'Server.php')); / / call function $result1 = $soap- > getName (); $result2 = $soap- > _ soapCall (" getUrl ", array ()); echo $result1."; echo $result2;} catch (SoapFault $e) {echo $e-> getMessage () } catch (Exception $e) {echo $e-> getMessage ();} this is the answer to the question on how to get started with Web Service. I hope the above content can be of some help to you. If you still have a lot of doubts to solve, you can follow the industry information channel for more related knowledge.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.