当前位置:网站首页>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>边栏推荐
- 几款分布式数据库的对比
- Requset + BS4 crawling shell listings
- Getting started with rce
- 常见问题之PHP——Fatal error: Allowed memory size of 314572800 bytes exhausted...
- When there are too many input boxes such as input transmitted at one time in the form, the post data is intercepted
- MySQL if else use case use
- PHP character capture notes 2020-09-14
- NFT value and white paper acquisition
- LeetCode_69(x 的平方根 )
- Can graduate students not learn English? As long as the score of postgraduate entrance examination English or CET-6 is high!
猜你喜欢

ELFK部署

Why do I support bat to dismantle "AI research institute"

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

Ordering system based on wechat applet

Sqllab 1-6 exercise

Those things I didn't know until I took the postgraduate entrance examination

Idea set method annotation and class annotation

OSI and tcp/ip protocol cluster

搭建一个仪式感点满的网站,并内网穿透发布到公网 2/2

神经网络物联网未来现状和趋势及看法
随机推荐
[server data recovery] a case of RAID5 data recovery stored in a brand of server
Attack and defense world web WP
如何把大的‘tar‘存档文件分割成特定大小的多个文件
[js] basic syntax - for loop
LeetCode_67(二进制求和)
Godson 2nd generation burn PMON and reload system
2022年机修钳工(高级)考试题模拟考试题库模拟考试平台操作
jasypt配置文件加密|快速入门|实战
::ffff:192.168.31.101 是一个什么地址?
web3.eth. Filter related
Convolutional Neural Networks简述
Personal component - message prompt
Data Lake (VII): Iceberg concept and review what is a data Lake
Laravel - view (new and output views)
Laravel框架运行报错:No application encryption key has been specified
Programmer growth Chapter 8: do a good job of testing
Recommendation number | what are interesting people looking at?
redis6主从复制及集群
2022 driller (drilling) examination question bank and simulation examination
UE源码阅读[1]---由问题入手UE中的延迟渲染