当前位置:网站首页>[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
边栏推荐
- 金融门户相关信息
- Brew install * failed, solution
- kmp思想及模板代码
- Pytorch Basics
- 如何写出好代码 — 防御式编程指南
- Gcnet: non - local Networks meet Squeeze excitation Networks and Beyond
- “簡單”的無限魔方
- Zzuli:1065 count the number of numeric characters
- Straighten elements (with transition animation)
- 15 C language advanced dynamic memory management
猜你喜欢

ThreadLocal memory leak

Centos8 installation mysql8.0.22 tutorial

Huawei Hongmeng OS, is it OK?

死磕大屏UI,FineReport开发日记

Innovation never stops -- the innovation process of nvisual network visualization platform for Excel import

brew install * 失败,解决方法

“简单”的无限魔方

Fabric. JS iText superscript and subscript

Visual Studio導入

Cube magique infini "simple"
随机推荐
如何写出好代码 — 防御式编程指南
Visual Studio导入
Fabric. JS three methods of changing pictures (including changing pictures in the group and caching)
“簡單”的無限魔方
运动健身的一些心得经验
Cambrian was reduced by Paleozoic venture capital and Zhike shengxun: a total of more than 700million cash
Go language web development is very simple: use templates to separate views from logic
Vscode paste image plugin saves image path settings
centos8安裝mysql8.0.22教程
Vite打包后的dist不能直接在浏览器打开吗
5g market trend in 2020
3D printer G code command: complete list and tutorial
With an amount of $50billion, amd completed the acquisition of Xilinx
Zzuli:1068 binary number
15 C language advanced dynamic memory management
软件测试答疑篇
Lantern Festival gift - plant vs zombie game (realized by Matlab)
Fabric. JS right click menu
[Chongqing Guangdong education] selected reading reference materials of British and American literature of Nanyang Normal University
Technologists talk about open source: This is not just using love to generate electricity