使用PHP Nusoap返回多个字符串

时间:2016-04-11 18:22:48

标签: php arrays string soap nusoap

我正在尝试创建一个客户端/服务器,它将使用Nusoap返回多个字符串。下面是我当前只返回一个字符串的代码:

服务器:

<?php
require_once "nusoap.php";

class zero_touch {

public function get_phone_number($ip_address) 
    {
        return "Single String";
    }
}
$server = new soap_server();
$server->configureWSDL("zero_touch", "http://aquarium.zapa.dsys.windstream.net/zero_touch/zero_touch");

$server->register("zero_touch.get_phone_number",
array("ip_address" => "xsd:string"),
array("return" => "xsd:string"),
"http://aquarium.zapa.dsys.windstream.net/zero_touch/zero_touch",
"http://aquarium.zapa.dsys.windstream.net/zero_touch/zero_touch#get_phone_number",
"rpc",
"encoded",
"Get zero_touch by ip_address");

@$server->service($HTTP_RAW_POST_DATA);

?>

客户端:

<?php
require_once "nusoap.php";

$client = new nusoap_client("zero_touch.wsdl", true);
$client->setCredentials("user","pass");
$error  = $client->getError();

if ($error) {
echo "<h2>Constructor error</h2><pre>" . $error . "</pre>";
}

$result = $client->call("zero_touch.get_phone_number", array("ip_address" => "10.248.17.208"));

echo $result;

?>

你能帮我解决任何可以让我返回多个字符串的东西吗?我尝试使用其他示例返回一个数组或多个字符串,大多数都会返回一个空数组或者根本没有返回。

0 个答案:

没有答案