当前位置:网站首页>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>边栏推荐
- Address book (linked list implementation)
- uplad_ Labs first three levels
- PHP generate Poster
- 神经网络物联网未来现状和趋势及看法
- Etcd database source code analysis -- rawnode simple package
- Network security HSRP protocol
- Selenium crawls Baidu pictures
- asp. Net read TXT file
- Aikesheng sqle audit tool successfully completed the evaluation of "SQL quality management platform grading ability" of the Academy of communications and communications
- Intranet penetration tool NetApp
猜你喜欢

About the problem and solution of 403 error in wampserver

Zibll theme external chain redirection go page beautification tutorial

牛客网:拦截导弹

Attack and defense world web WP

Idea set method annotation and class annotation

Internal JSON-RPC error. {"code":-32000, "message": "execution reverted"} solve the error

Liar report query collection network PHP source code

LeetCode_2(两数相加)

Elfk deployment

Anchor navigation demo
随机推荐
Basic characteristics and isolation level of transactions
Laravel框架运行报错:No application encryption key has been specified
[South China University of technology] information sharing of postgraduate entrance examination and re examination
神经网络物联网未来发展趋势怎么样
Zhubo Huangyu: these spot gold investment skills are not really bad
金融壹賬通香港上市:市值63億港元 葉望春稱守正篤實,久久為功
What is information security? What is included? What is the difference with network security?
Brief introduction to revolutionary neural networks
LeetCode_67(二进制求和)
leetcode 10. Regular expression matching regular expression matching (difficult)
Idea remote debugging agent
[js] basic syntax - for loop
jasypt配置文件加密|快速入门|实战
Prefix, infix, suffix expression "recommended collection"
uplad_ Labs first three levels
Attack and defense world crypto WP
Primary code audit [no dolls (modification)] assessment
web3.eth. Filter related
matlab学习2022.7.4
金融壹账通香港上市:市值63亿港元 叶望春称守正笃实,久久为功