Webservice-php-1 (+), webservice-php-16
Recently read a lot about PHP WebService information, thanks to Yan 18 sharing, helped me to build the process of the server. Take your study notes as follows, which contains notes from Yan 18.
WebService
1 Quick Learn WebService
Popular say: In a certain XML format, the method of invoking the remote server, and the server returns XML content in a certain format.
A "certain format"----SOAP (Simple Object access Protocol) is a simple protocol for exchanging information in a decentralized or distributed environment and is an XML-based co-
On.
Remote server----typically deliver messages over the HTTP protocol
Summary: Webservie = = HTTP protocol + SOAP-formatted XML
Example 1:soap request
Post/webservices/mobilecodews.asmx http/1.1
Host:webservice.webxml.com.cn
Content-type:text/xml; Charset=utf-8
content-length:354
SOAPAction: "Http://WebXml.com.cn/getMobileCodeInfo"
Restart Apache
The PHP SoapClient class can be used to request WebService
new soapclient ('http://webservice.webxml.com.cn/WebServices/MobileCodeWS.asmx? WSDL');p rint_r ($soap->getmobilecodeinfo ('mobilecode' ='13**********'));
Array ([0] = getmobilecodeinforesponse getmobilecodeinfo (getmobilecodeinfo $parameters) [ 1] = getdatabaseinforesponse getdatabaseinfo (getdatabaseinfo $parameters)) Array ([0 struct getmobilecodeinfo {string mobilecode; string UserID;} [1struct getmobilecodeinforesponse {string Getmobilecodeinforesult;} [2struct getdatabaseinfo {}[3struct getdatabaseinforesponse {arrayofstring getdatabaseinforesult;} [4struct arrayofstring {
string string;
}
// Call Method Print_r ($soap->getmobilecodeinfo ('mobilecode' = ' 13426060134 ') ) );
return results
13*********: Beijing Beijing Beijing Mobile Dynamic Zone card)
3 Building WebService Server
What is WSDL?
WSDL is the specification of WebService.
'1.0'encoding ='UTF-8'?>
'
custom name [optional]
'
targetnamespace=
'
namespace [general URL]
'
Xmlns:tns=
'
namespace [value Same as targetnamespace]
'
Xmlns:soap=
'
http://schemas.xmlsoap.org/wsdl/soap/
'
xmlns:xsd=
'
Http://www.w3.org/2001/XMLSchema
'
Xmlns:soapenc=
'
http://schemas.xmlsoap.org/soap/encoding/
'
xmlns:wsdl=
'
http://schemas.xmlsoap.org/wsdl/
'
xmlns=
'
http://schemas.xmlsoap.org/wsdl/
'>
"
http://www.w3.org/2001/XMLSchema
"
targetnamespace=
"
[value ditto TNS]
">
'
operation name request
'> ' term
' type=
'
Xsd:stri ng
"/>
'
operation name response
'>
'
value
' type=
'
xsd:st Ring
"/>
'
action list name
'>
'
action name
'>
'
TNS: operation name Request
'/>
'TNS: Operation name Response'/>
'
channel name under WS
'Type=
'
TNS: List of actions under channel
'>
'
RPC
'
Transport=
'
http://schemas.xmlsoap.org/soap/http
'/>
'
test
'>
'
http://www.cwtservice.cn/newOperation/
'/>
'
encoded
'
namespace=
'
urn:xmethods-delayed-quotes
' encodingstyle= 'http://schemas.xmlsoap.org/soap/encoding/'/>
'
encoded
'
namespace=
'
urn:xmethods-delayed-quotes'encodingstyle= 'http://schemas.xmlsoap.org/soap/encoding/' />
'
WebService name [such as WEATHERWS,SHOPWS]
'>
'
ws under the name of the channel [e.g. CARTSOAP, shopping cart service]
' b
inding=
'
tns:[channel name, same left]
'>
'
http://[webservice address]
'/>
http://www.bkjia.com/PHPjc/993279.html www.bkjia.com true http://www.bkjia.com/PHPjc/993279.html techarticle webservice-php-1 (), webservice-php-16 recently read a lot about PHP WebService information, thanks to Yan 18 sharing, helped me to build the service side of the process. Will learn to record notes ...