PHP SOAP响应为空,但__last_response不是
问题描述:
我用的NuSOAP服务的文件,这里是我service.phpPHP SOAP响应为空,但__last_response不是
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我有righ来自Service的答案。
可能是什么问题?
谢谢。
答
好的!我处理这个。正如注意到的F0G,他有不同的结果,然后我问题是PHP缓存我的WSDL文件。当我把
ini_set("soap.wsdl_cache_enabled", "0");
一切顺利。谢谢。
在你的代码片段中,响应是'string(41)“没有列出该类别下的产品:对我来说是”A“。你确定你没有看错方向吗? – F0G
你使用相同的client.php代码?我的var_dump($ response);是NULL 这里URL到client.php https://doktormobil.ru/cms/soap/client.php –
是的,完全一样的代码。 – F0G