nuSOAP. PHP- SoapClient. nuSoap wsdl, , . nuSOAP :
:
<?php
require_once('nuSOAP/lib/nusoap.php');
function HelloWorld(){
return 'HelloWorld';
}
function Hello($name){
return 'Hello '.$name;
}
$server = new nusoap_server();
$server->configureWSDL('webservicenamespace', 'urn:webservicenamespace');
$server->register('HelloWorld', array(), array('result' => 'xsd:string'));
$server->register('Hello', array('name' => 'xsd:string'), array('result' => 'xsd:string'));
if (isset($error))
{
$fault =
$server->fault('soap:Server','',$error);
}
$post = file_get_contents('php://input');
$server->service($post);
?>
:
<?php
require_once('nuSOAP/lib/nusoap.php');
$client = new nusoap_client('http://pathtourl/sample_webservice.php?wsdl', true);
$err = $client->getError();
if ($err) {
echo '<h2>Constructor error</h2><pre>' . $err . '</pre>';
}
$result = $client->call('Hello', array('name' => 'Scott'));
if ($client->fault) {
echo '<h2>Fault</h2><pre>';
print_r($result);
echo '</pre>';
} else {
$err = $client->getError();
if ($err) {
echo '<h2>Error</h2><pre>' . $err . '</pre>';
} else {
echo '<h2>Result</h2><pre>';
print_r($result);
echo '</pre>';
}
}
echo '<h2>Request</h2>';
echo '<pre>' . htmlspecialchars($client->request, ENT_QUOTES) . '</pre>';
echo '<h2>Response</h2>';
echo '<pre>' . htmlspecialchars($client->response, ENT_QUOTES) . '</pre>';
echo '<h2>Debug</h2>';
echo '<pre>' . htmlspecialchars($client->debug_str, ENT_QUOTES) . '</pre>';
?>
Now that you want to make a client, you need your wsdl, can you just get it by adding? wsdl to your ie link (webservice.php? wsdl)
Hope this helps :) Good luck with your web service.
source
share