当前位置:网站首页>PHP development and testing WebService (soap) -win
PHP development and testing WebService (soap) -win
2022-07-02 05:49:00 【Jill__ er】
WebService Is a cross programming language and cross operating system platform remote call technology .
> Environment building
1.phpStudy link :https://pan.baidu.com/s/1Uk5Cq28tSXBkolgmSarYnw?pwd=x2b8
2.phpStudy Extraction code :x2b8
> understand webservice
1. On the face of it ,WebService It's an application that exposes itself to the outside world through Web Calling API, In other words, it can be programmed through Web To call this application . We call this WebService Is called the client , And to provide this WebService Is called the server side .
2. At a deeper level ,WebService Is a new platform for building interoperable distributed applications , It's a platform , It's a set of standards . It defines how an application works in Web Interoperability on the Internet , You can use any language you like , Write on any platform you like Web service , As long as we can get through Web service Standards query and access these services .
3.Web Service It's a platform independent , Low coupling , Self contained 、 Based on programmable web Applications for , Open... Can be used XML( A subset of the standard generic markup language ) Standard to describe 、 Release 、 Find out 、 Coordinate and configure these applications , Applications for developing distributed, interoperable applications . [1]
4.Web Service technology , It can make different applications run on different machines without the aid of additional 、 Specialized third-party software or hardware , You can exchange data or integrate with each other . basis Web Service Between the application of specification implementation , Whatever language they use 、 What is the platform or internal protocol , Can exchange data with each other .Web Service It's self describing 、 Self contained available network modules , Can perform specific business functions .Web Service It's also easy to deploy , Because they are based on some conventional industry standards and some existing technologies , Such as a subset of the standard General Markup Language XML、HTTP.Web Service Reduce the cost of application interface .Web Service It provides a common mechanism for the integration of business processes among the whole enterprise or even multiple organizations .
> Web The three cores of service
1、Soap:
SOAP(Simple Object Access Protocol, Simple object access protocol ) It's based on xml The agreement , Used in step-by-step applications can recognize . in addition ,SOAP There is no programming language defined by itself , This makes SOAP It can be delivered to various remote systems in the form of messages .SOAP The transmission protocol used , It can be HTTP,SMTP,POP3,JMS.
SOAP It includes 4 part :
01.“SOAP encapsulation (Envelope)”:
Define what a description information describes , Who sent it , Who should deal with him , And how to deal with their framework .02.“SOAP Encoding rules ”:
An instance that represents the data type that the application needs to use .03.“SOAP RPC":
Represents a protocol for calling and answering in a remote procedure .04.“SOPA binding ”:
Exchange information using underlying protocols .2.WSDL:
WSDL(Web Service Description Language,web Service description language ) It's a XML file , He defines a given in an abstract way independent of the concrete language web Relevant operations and messages of service recipients .3.UDDI:
UDDI(Universal Description Discovery and Integration, Unified description of discovery and integration protocols ) It's a norm , Defines and web Release of service related information , Discover and manage .
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
Refer to the connection :
http://47.106.68.247/ycsyth/webservices/ycsbizService?wsdl
https://blog.csdn.net/qq_33196814/article/details/122303882
https://www.cnblogs.com/guanfuchang/p/5985070.html
边栏推荐
猜你喜欢

Appnuim environment configuration and basic knowledge

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

Disable access to external entities in XML parsing

Importation de studio visuel

JVM class loading mechanism

【論文翻譯】GCNet: Non-local Networks Meet Squeeze-Excitation Networks and Beyond

15 C language advanced dynamic memory management

Huawei Hongmeng OS, is it OK?

2022-2-14 learning xiangniuke project - Section 6 displays login information

With an amount of $50billion, amd completed the acquisition of Xilinx
随机推荐
Zzuli:1066 character classification statistics
OLED12864 液晶屏
Installation du tutoriel MySQL 8.0.22 par centos8
File contains vulnerabilities (II)
Ubuntu 20.04 installing mysql8
VSCode paste image插件保存图片路径设置
Lingyunguang rushes to the scientific innovation board: the annual accounts receivable reaches 800million. Dachen and Xiaomi are shareholders
ThreadLocal memory leak
金融门户相关信息
js判断移动端还是pc端
Software testing learning - day 4
Usage record of vector
线程池概述
Zzuli:1062 greatest common divisor
“简单”的无限魔方
Here comes a new chapter in the series of data conversion when exporting with easyexcel!
Visual Studio导入
all3dp.com网站中全部Arduino项目(2022.7.1)
简单封装 js并应用
Alibaba: open source and self-developed liquid cooling data center technology