当前位置:网站首页>Implementation process of WSDL and soap calls under PHP5
Implementation process of WSDL and soap calls under PHP5
2022-07-05 13:56:00 【Brother Xing plays with the clouds】
One 、 Basic concepts
SOAP(Simple Object Access Protocol ) Simple object access protocols are decentralized or Distributed A simple protocol for exchanging information in the environment of , It's based on XML The agreement , It has four parts :SOAP encapsulation (envelop), Encapsulation definition A description of what is in the message , Who sent it , Who should accept and deal with it and how to deal with them ;SOAP Encoding rules (encoding rules), An instance that represents the data type that the application needs to use ; SOAP RPC Express (RPC representation), Represents the protocol for remote procedure calls and replies ;SOAP binding (binding), Exchange information using underlying protocols .
WSDL(Web Service Description Language) It's just a description XML Web Standards of service XML Format ,WSDL from Ariba、Intel、IBM And Microsoft and other developers . It defines a given... In an abstract way independent of the concrete language Web Service receiving and sending Related operations and messages . By definition , You can't put WSDL As an object interface definition language , for example ,CORBA or COM Such as application architecture will use object interface definition language . WSDL Keep the agreement neutral , But it does have bindings built in SOAP Support for , Thus the same as SOAP Established an inseparable connection . therefore , When I discuss in this article WSDL When , I'll assume you hold SOAP As your communication protocol .
SOAP and WSDL Although it is web service Two standards of , But there is no necessary connection between the two , Can be used independently . The relationship between them is similar HTTP and Html The relationship between . The former is an agreement , The latter is for a Web Server Description of .
Two 、PHP5 Configuration below
stay php The configuration file for php.ini in , find
extension=php_soap.dllAnd then, you can put the ; Remove the number , And then restart web service
3、 ... and 、 Inquire about web service Methods and parameters 、 data type
The inbound interface of a provincial telecom company is http://***.******.com/services/AcceptedBusiness?wsdl We use SoapClient Of __geunctions() and __getTypes() Method to view the methods of the interface , Parameters and data types Only __getFunctions The interfaces listed in can be soap call . Create code under the root directory soap.php
<?php
header("content-type:text/html;charset=utf-8");
try {
$client = new SoapClient("http://***.******.com/services/AcceptedBusiness?wsdl");
print_r($client->__getFunctions());
print_r($client->__getTypes());
} catch (SOAPFault $e) {
print $e;
}
?>Run in browser :http://localhost/soap.php after , The results are as follows
Array
(
[0] => ArrayOf_xsd_anyType introduceAcceptedBusiness(string $c3, string $c4, string $linkman, string $linknum, string $num, string $idcard, string $remark, string $address)
[1] => ArrayOf_xsd_anyType introduceAcceptedBusinessByAiZhuangWei(string $subname, string $linkphone, string $idcard, string $address, string $businesstype, string $marketcode, string $surveycode, string $commanager, string $commanagerphone, string $bendiwang, string $fenju, string $zhiju, string $remark)
[2] => string introduceAcceptedBusinessByStandardInterface(string $xmlStr)
[3] => string introduceAcceptedBusinessByCallOut(string $xmlStr)
[4] => string introduceAcceptedBusinessByYddj(string $xmlParam)
[5] => ArrayOf_xsd_anyType queryAcceptedBusinessByAiZhuangWei(string $surveycode, string $starttime, string $endtime)
[6] => string queryCallOutOrderByConfig(string $xmlParam)
)
Array
(
[0] => anyType ArrayOf_xsd_anyType[]
)There's a way introduceAcceptedBusinessByStandardInterface(string $xmlStr), It will be the interface to be used mentioned in the development document , Parameter is xml character string
In addition, some interfaces mention SoapHeader authentication , It's about joining __setSoapHeaders Method , Details can be viewed http://php.net/manual/zh/soapclient.setsoapheaders.php
Four 、 Submit the receipt
This step is to splice according to the development documents xml character string , And then as a introduceAcceptedBusinessByStandardInterface Parameters passed in establish acceptedbusiness.php, The contents are as follows
<?php
header("content-type:text/html;charset=utf-8");
try {
$client = new SoapClient('http://***.*******.com/services/AcceptedBusiness?wsdl');
$xml = "
<?xml version='1.0' encoding='UTF-8' ?>
<PACKAGE>
<C3>** telecom </C3>
<C4></C4>
<LINKMAN> Zhang San </LINKMAN>
<LINKNUM>13412341234</LINKNUM>
<LINKADDRESS> Guangdong shenzhen </LINKADDRESS>
<REMARK>iPhone 6</REMARK>
<CHANNEL></CHANNEL>
<GRIDCODE>1111111111111111111111111111111</GRIDCODE>
<AGENTCODE>2111</AGENTCODE>
<KEY>1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111</KEY>
</PACKAGE>
";
$return = $client->introduceAcceptedBusinessByStandardInterface($xml);
print_r($return);
} catch (SOAPFault $e) {
print_r('Exception:'.$e);
}
?>After execution in the browser , return
<?xml version="1.0" encoding="UTF-8"?>
<PACKAGE>
<STATUS>0</STATUS>
<REASON> Order entry succeeded !</REASON>
<ORDERSEQ>2014100905523549742</ORDERSEQ>
</PACKAGE>边栏推荐
- LeetCode_2(两数相加)
- Blue Bridge Cup study 2022.7.5 (morning)
- [South China University of technology] information sharing of postgraduate entrance examination and re examination
- jasypt配置文件加密|快速入门|实战
- Request + BS4 crawl Netease cloud music popular comments
- Usage, installation and use of TortoiseSVN
- JS takes key and value from an array object to form a new object
- aspx 简单的用户登录
- These 18 websites can make your page background cool
- When there are too many input boxes such as input transmitted at one time in the form, the post data is intercepted
猜你喜欢

upload (1-6)

Scientific running robot pancakeswap clip robot latest detailed tutorial

【公开课预告】:视频质量评价基础与实践

Detailed explanation of IP address and preparation of DOS basic commands and batch processing

Deep copy is hard

几款分布式数据库的对比

Kotlin collaboration uses coroutinecontext to implement the retry logic after a network request fails

zabbix 监控

Rk3566 add LED

Comparison of several distributed databases
随机推荐
Kotlin collaboration uses coroutinecontext to implement the retry logic after a network request fails
Intranet penetration tool NetApp
Zibll theme external chain redirection go page beautification tutorial
Selenium crawls Baidu pictures
Network security HSRP protocol
清大科越冲刺科创板:年营收2亿 拟募资7.5亿
Liste des liens (simple)
When there are too many input boxes such as input transmitted at one time in the form, the post data is intercepted
Apicloud studio3 WiFi real machine synchronization and WiFi real machine preview instructions
Laravel - model (new model and use model)
Xampp configuring multiple items
Etcd database source code analysis -- rawnode simple package
Aikesheng sqle audit tool successfully completed the evaluation of "SQL quality management platform grading ability" of the Academy of communications and communications
Idea set method annotation and class annotation
Why do I support bat to dismantle "AI research institute"
Set up a website with a sense of ceremony, and post it to the public 2/2 through the intranet
Primary code audit [no dolls (modification)] assessment
Data Lake (VII): Iceberg concept and review what is a data Lake
UE source code reading [1]--- starting with problems delayed rendering in UE
Requset + BS4 crawling shell listings