我在服务文件中使用nusoap这是我的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);
生成的WSDL文件URL是
https://doktormobil.ru/cms/soap/service.php?wsdl
我的client.php是
$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);
响应为NULL但在$ client-> __ last_response中我得到了Service的正确答案。
可能是什么问题?
谢谢。
答案 0 :(得分:1)
OK!我处理这件事。正如注意到F0G,他有不同的结果。问题是PHP缓存了我的WSDL文件。当我把
ini_set("soap.wsdl_cache_enabled", "0");
一切都很顺利。谢谢。