I use nusoap for service file here is my service.php
require_once "lib/nusoap.php";
function getProd($category) {
if ($category['category'] == "books") {
return join(",", array(
"The WordPress Anthology",
"PHP Master: Write Cutting Edge Code",
"Build Your Own Website the Right Way")
);
} else {
return "No products listed under that category: ".$category['category'];
}
}
$server = new soap_server();
$server->configureWSDL("productlist", "urn:productlist");
$server->register("getProd",
array("category" => "xsd:string"),
array("return" => "xsd:string"),
"urn:productlist",
"urn:productlist#getProd",
"rpc",
"encoded",
"Get a listing of products by category"
);
$post = file_get_contents('php://input');
$server->service($post);
Generated WSDL file url is
https://doktormobil.ru/cms/soap/service.php?wsdl
My client.php is
$client = new SoapClient("https://doktormobil.ru/cms/soap/service.php?wsdl", array('trace' => 1));
$params = array("category" => "books");
$response = $client->getProd($params);
var_dump($client);
var_dump($response);
Response is NULL but in $client->__last_response I have the right answer from Service.
What can be the problem?
Thank you.
OK! I deal with this. As noticed F0G, he have differ results then I. Problem was that PHP cached my WSDL file. When I put
ini_set("soap.wsdl_cache_enabled", "0");
Everything goes fine. Thank you.