php soap 响应为空,但 __last_response 不是
php soap response is null, but __last_response is not
我使用 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);
Response 为 NULL 但在 $client->__last_response 中我从 Service 得到了正确的答案。
可能是什么问题?
谢谢。
好的!我处理这个。正如 F0G 所注意到的,他的结果与我不同。问题是 PHP 缓存了我的 WSDL 文件。当我把
ini_set("soap.wsdl_cache_enabled", "0");
一切顺利。谢谢。
我使用 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);
Response 为 NULL 但在 $client->__last_response 中我从 Service 得到了正确的答案。
可能是什么问题?
谢谢。
好的!我处理这个。正如 F0G 所注意到的,他的结果与我不同。问题是 PHP 缓存了我的 WSDL 文件。当我把
ini_set("soap.wsdl_cache_enabled", "0");
一切顺利。谢谢。