PHP Web Services Using WSDL Step By Step Tutorial - Part 8: We have finished talk about WSDL document. Now, we will colaborate with SOAP. This soap is provided at PHP 5 (we ever talk about SOAP use nusoap for PHP 4).
create a file named "hello_server.php" within folder where hello.wsdl has placed (within www/test/wsdl). Enter following code:
<?php
if(!extension_loaded("soap")){
dl("php_soap.dll");
}
ini_set("soap.wsdl_cache_enabled","0");
$server = new SoapServer("hello.wsdl");
function doHello($yourName){
return "Hello, ".$yourName;
}
$server->AddFunction("doHello");
$server->handle();
?>
This service has one method "doHello". And this method need a parameter named $yourName. It will return text such as "Hello, ".$yourName.
| Series this article: Web Services - WSDL: Anatomy of WSDL Document Web Services - WSDL: Sample WSDL Document Web Services - WSDL: Types Web Services - WSDL: Messages Web Services - WSDL: Port Types Web Services - WSDL: Bindings Web Services - WSDL: Service Web Services - WSDL: Creating SOAP Server Web Services - WSDL: Testing with SOAP Client advertisements blog comments powered by Disqus |

