我使用 php 中的本机肥皂服务器类在 php 中创建了一个肥皂服务器。我需要的编码是ISO-8859-1
. 我在创建这样的soap服务器时尝试过这样做:
$server = new SoapServer('./AdviseAndPay.wsdl',array('encoding'=>'ISO-8859-1'));
但是,http 标头和soap 响应的编码仍然是utf-8。
我正在SoapVar
为肥皂响应返回一个本机 php 对象。我尝试ISO-8859-1
使用以下代码将标题内容类型设置为:
header('Content-Type: text/xml;charset=iso-8859-1')
就在返回之前SoapVar
。但是,我仍然在 http 标头和soap响应中都得到了 utf-8 的编码。
我在stackoverflow中尝试了答案,并且在定义soap服务器时设置了编码类型,但这对我不起作用。
请你帮助我好吗。提前致谢。
Edit
:这是soap服务器响应的原始http响应。
HTTP/1.1 200 OK
Date: Wed, 15 Jan 2014 04:47:16 GMT
Server: Apache/2.2.22 (Ubuntu)
X-Powered-By: PHP/5.4.9-4ubuntu2.4
Cache-Control: no-store, no-cache, must-revalidate, private, max-age=0
Pragma: no-cache
Expires: Wed, 11 Jan 1984 05:00:00 GMT
Vary: Accept-Encoding
Content-Encoding: gzip
Content-Length: 225
Keep-Alive: timeout=5, max=100
Connection: Keep-Alive
Content-Type: text/xml; charset=utf-8
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
<SOAP-ENV:Body><ns2:responseType xmlns:ns2="http://tempuri.org/response">
<code>00</code>
<message>incorrect username/password</message>
<responseBody>
<responseStr>5</responseStr>
</responseBody>
</ns2:responseType>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
Edit
:
我发现有一个关于肥皂服务器响应的编码类型的 php 错误报告。2008 年关于这个说法的最新评论是在 2008 年。这是链接:php bug
任何人都可以验证他们是否有类似的肥皂服务器编码问题?