0

我在收到此错误的客户端上创建了一个 WSDL Web 服务

Array ( [faultcode] => SOAP-ENV:Server [faultstring] => SOAP-ERROR: Encoding: string 'Luik / Li\xe8...' is not a valid utf-8 string )

试图添加$server->setEncoding('UTF-8');,但它在下面的 api 调用上给出错误是我的服务器脚本。

ini_set("soap.wsdl_cache_enabled", "0"); 
$server = new SoapServer('hello.wsdl', array('uri' => 'http://schemas.xmlsoap.org/wsdl/','classmap' => 'helloclass') );
$server->setClass('hello');
$server->handle();

function getDIDArea()
{
   $ret_final = new soapVar($ErrorMessage, SOAP_ENC_ARRAY,NULL, "urn:helloWSDL");
   return $ret_final;
}

你好.wsdl

<?xml version="1.0" encoding="UTF-8"?>
<definitions xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:tns="urn:helloWSDL" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns="http://schemas.xmlsoap.org/wsdl/" targetNamespace="urn:helloWSDL">

客户端代码:

require_once "nusoap.php";
$soapclient= new soapclient('http://localhost/WebGetServer.wsdl', true);
$SoapResult = $soapclient->call("hello", $parameters,'urn:hello');
print_r($SoapResult);

它总是返回相同的错误。这是服务器返回的结果Luik / Liège

4

0 回答 0