我不知道如何让NuSOAP对内容类型使用UTF-8。它一直发出"ISO-8859-1“。下面是我尝试过的相关代码:
$soapclient=new soapclient($url1,'wsdl');
$soapclient->http_encoding='utf-8';
$soapclient->defencoding='utf-8';
if($soapclient->fault){
$retdata=$soapclient->fault;
}else{
if($soapclient->getError()){
$retdata=$soapclient->getError();
}else{
$params=array($xmldata);
$retdata=$soapclient->call($doit,$params,$url1,$url2);
}
} 下面是请求:
POST xxxxxxxxxxxx HTTP/1.0
Host: xxxxxxxxxxxxx
User-Agent: NuSOAP/0.9.5 (1.123)
Content-Type: text/xml; charset=ISO-8859-1
SOAPAction: "xxxxxxxxxxxxxxxxx"
Content-Length: 1629我甚至进入了nusoap.php,修改了几行硬编码了ISO的代码。我遗漏了什么?
发布于 2011-03-16 06:00:41
尝试:
$soapClient->soap_defencoding = 'UTF-8';
$soapClient->decode_utf8 = false;还要确保你发送的是utf8编码的数据,否则就有点矛盾了。(utf8_encode())。
发布于 2012-03-22 02:57:15
使用SoapClient对我来说很好。
下面是一个示例:
<?php
$client = new SoapClient(
"http://localhost/app/ws/index.php?ws=data&wsdl",
array('encoding' => 'UTF-8',)
);
$data = $client->__soapCall("data.getData", array(1));
?> 使用PHP 5.3.3进行了测试。
发布于 2012-08-22 13:20:53
变化
$soapclient->defencoding='utf-8';至
$soapclient->soap_defencoding='utf-8';https://stackoverflow.com/questions/5317858
复制相似问题