1
我用的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的答案。
可能是什麼問題?
謝謝。
在你的代碼片段中,響應是'string(41)「沒有列出該類別下的產品:對我來說是」A「。你確定你沒有看錯方向嗎? – F0G
你使用相同的client.php代碼?我的var_dump($ response);是NULL 這裏URL到client.php https://doktormobil.ru/cms/soap/client.php –
是的,完全一樣的代碼。 – F0G