The implemented Soap server is provided to the client for calling functions, accept the parameters passed in by the client, and write
The implemented Soap server is provided to the client for calling the function, accept the parameters passed by the client, and
The processing result is returned to the client. The function functions as the sum of the returned parameters. the specific code for file name soapServer. php is as follows:
/**
* @ Soap instance 2 Server example
* @ Author PHP technology blog, PHP blog, WWW. PHPCQ. COM
*/
Function soap_add ($ num1, $ num2 ){
If (trim ($ num1 )! = (Int) $ num2 | trim ($ num2 )! = (Int) $ num2 ){
Return new SoapFault ('1', 'invalid user data! ');
} Else {
Return $ num1 + $ num2;
}
}
$ SoapServer = new SoapServer (null, array ('URL' => 'Soap '); // Create a SoapServer object
$ SoapServer-> addFunction ('soap _ add'); // register a service function
$ SoapServer-> handle (); // process and generate Soap
The above code compiled a soap_add function to implement the sum of two parameters, and the page supports remote calls from the client.
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service