当前位置:网站首页>[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
边栏推荐
- 7. Eleven state sets of TCP
- [Chongqing Guangdong education] selected reading reference materials of British and American literature of Nanyang Normal University
- A collection of commonly used plug-ins for idea development tools
- 【论文翻译】GCNet: Non-local Networks Meet Squeeze-Excitation Networks and Beyond
- Opencv LBP features
- [personal test] copy and paste code between VirtualBox virtual machine and local
- all3dp. All Arduino projects in com website (2022.7.1)
- Centos8 installation mysql8.0.22 tutorial
- Balsamiq wireframes free installation
- MySQL foundation --- query (learn MySQL foundation in 1 day)
猜你喜欢

Importation de studio visuel

15 C language advanced dynamic memory management

3D printer G code command: complete list and tutorial

ThreadLocal memory leak

KMP idea and template code
![[golang syntax] be careful with the copy of slices](/img/5e/1c82c58940939b94d03377ebdc03e3.jpg)
[golang syntax] be careful with the copy of slices

2022-2-14 learning xiangniuke project - Section 7 account setting

Vscode paste image plugin saves image path settings

【论文翻译】GCNet: Non-local Networks Meet Squeeze-Excitation Networks and Beyond

Alibaba: open source and self-developed liquid cooling data center technology
随机推荐
Taskbar explicit / implicit toggle function
死磕大屏UI,FineReport开发日记
1036 Boys vs Girls
Zzuli:1064 encrypted characters
软件测试 - 概念篇
Disable access to external entities in XML parsing
brew install * 失败,解决方法
Usage record of vector
kmp思想及模板代码
Visual studio import
KMP idea and template code
Technologists talk about open source: This is not just using love to generate electricity
How to write good code - Defensive Programming Guide
在线音乐播放器app
Zzuli:1067 faulty odometer
Zzuli:1069 learn from classmate Z
vite如何兼容低版本浏览器
Applet jumps to official account
Fabric. JS background is not affected by viewport transformation
2022-2-14 learning xiangniuke project - Section 7 account setting