Home >Backend Development >PHP Tutorial >Communication between webServicephp's soap and nusoap server and client
PHP SOAP Server
It is very easy to set up a SOAP server with PHP and Soap. Basically, you just write the functions you want to expose to your Web service, and then register them with Soap. There are also two steps required to complete the establishment of the PHP SOAP server. First, you have to create an instance of the Soap object in your PHP code, and then use the HTTP POST method to pass the original data to Soap for processing
Soap has been integrated in php5. The use of SOAP is relatively simple, and the most commonly used one is The classes are SoapServer and SoapClient, where SoapServer is used to create the Webservice server, and the SoapClient class is used to call the Webservice, which is the client. Since soap is integrated from php5, you only need to enable the soap component in php.ini.
Take Windows as an example:
Communication between webServicephps soap and nusoap server and client |
|
Soap instance:
Communication between webServicephps soap and nusoap server and client. First create a service end, since the integrated php5 does not need to introduce any soap support files, it can be created directly. For example, the access address is set to http://Communication between webServicephps soap and nusoap server and clientCommunication between webServicephps soap and nusoap server and client7.0.0.Communication between webServicephps soap and nusoap server and client/test.php.
0Communication between webServicephps soap and nusoap server and client 0Communication between webServicephps soap and nusoap server and client 03 04 05 06 07 08 09 Communication between webServicephps soap and nusoap server and client0 Communication between webServicephps soap and nusoap server and clientCommunication between webServicephps soap and nusoap server and client |
$webService SoapServer(null, ( => ));
|
$client = newSoapClient(null,array ( ) |
"location"
=> ,
$demo However, Nusoap is more flexible than soap. Their operation processes are basically the same, but there are slight deviations in the processing process. The use of NuSOAP is also relatively simple. The most commonly used classes are soap_server and nusoap_client, among which soap_server It is used to create the Webservice server, and the class nusoap_client is used to call the Webservice, which is the client. The definitions of these two classes are in lib/nusoap.php, so we need to reference this file when creating or calling the Webservice interface program. NuSoap is a WebService programming tool in PHP environment, used to create or call WebService. It is an open source software, which is a series of PHP classes written entirely in PHP language that sends and receives SOAP messages through HTTP. It is developed by NuSphere Corporation (http://dietrich.ganx4.com/nusoap/). One advantage of NuSOAP is that it does not require extension library support. This feature allows NuSoap to be used in all PHP environments and is not affected by server security settings. Provide nusoap download: nusoap-0.9.5 Nusoap instance: Communication between webServicephps soap and nusoap server and client. The first thing to do is still to create the server. I just mentioned that there is a slight deviation, so I created this on the server. First introduce nusoap Support class library
|