当前位置:网站首页>[whether PHP has soap extensions installed] a common problem for PHP to implement soap proxy: how to handle class' SoapClient 'not found in PHP
[whether PHP has soap extensions installed] a common problem for PHP to implement soap proxy: how to handle class' SoapClient 'not found in PHP
2022-07-02 05:49:00 【Jill__ er】
Browser view php Version of
phpstudy- Website - management - Open the root directory
Turn on soap Expand
- see php Configuration information
- Write in the root directory test.php file , The contents are as follows :
- Open the browser to view the profile information : Address field input http://localhost/test.php, And find soap Information :
- Turn on soap Expand
- Look again php Configuration information , lookup soap Open successfully or not
- Open the browser to view the profile information : Address field input http://localhost/test.php, And find soap Information :
restart apache
Web Service example
Create in the root directory soap Folder , The file structure is as follows :
Client.php
<?php
try{
// non-wsdl Way to call web service
// establish 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."<br/>";
echo $result2;
} catch(SoapFault $e){
echo $e->getMessage();
}catch(Exception $e){
echo $e->getMessage();
}
Server.php
<?php
// SiteInfo Class is used to process requests
Class SiteInfo
{
/**
* Return site name
* @return string
*
*/
public function getName(){
return " Novice tutorial -test";
}
public function getUrl(){
return "www.runoob.com";
}
}
// establish SoapServer object
$s = new SoapServer(null,array("location"=>"http://localhost/soap/Server.php","uri"=>"Server.php"));
// export SiteInfo All the functions in the class
$s->setClass("SiteInfo");
// Deal with one SOAP request , Call the necessary functions , And send back a response .
$s->handle();
?>
test webservice example
Open the browser and type :http://localhost/soap/Client.php
Reference link :https://blog.csdn.net/gayayang/article/details/6953367
边栏推荐
猜你喜欢
[golang syntax] be careful with the copy of slices
7. Eleven state sets of TCP
RGB infinite cube (advanced version)
centos8安装mysql8.0.22教程
How to write good code - Defensive Programming Guide
The Hong Kong Stock Exchange learned from US stocks and pushed spac: the follow-up of many PE companies could not hide the embarrassment of the world's worst stock market
OLED12864 液晶屏
A collection of commonly used plug-ins for idea development tools
[technical notes-08]
Balsamiq wireframes free installation
随机推荐
js判断移动端还是pc端
Zzuli:1061 sequential output of digits
【LeetCode】Day92-盛最多水的容器
Fabric. JS round brush
File contains vulnerability (I)
Zzuli:1067 faulty odometer
《CGNF: CONDITIONAL GRAPH NEURAL FIELDS》阅读笔记
【技术随记-08】
A collection of commonly used plug-ins for idea development tools
php继承(extends)
【pyinstaller】_ get_ sysconfigdata_ name() missing 1 required positional argument: ‘check_ exists‘
Vscode paste image plugin saves image path settings
With an amount of $50billion, amd completed the acquisition of Xilinx
Usage record of vector
Minimum value ruler method for the length of continuous subsequences whose sum is not less than s
Ubuntu 20.04 installing mysql8
Thread pool overview
all3dp. All Arduino projects in com website (2022.7.1)
Win10 copy files, save files... All need administrator permission, solution
Fabric. JS free draw rectangle