我在php中使用本地soap服務器類創建了一個soap服務器。我需要的編碼是ISO-8859-1
。 我試圖做到這一點,同時創造這樣的SOAP服務器:php設置soap服務器響應的編碼類型
$server = new SoapServer('./AdviseAndPay.wsdl',array('encoding'=>'ISO-8859-1'));
然而,對於HTTP頭中的編碼和SOAP響應仍是UTF-8。
我正在返回肥皂響應的本機php SoapVar
對象。我已經嘗試了頭內容類型與此代碼設置爲ISO-8859-1
:
header('Content-Type: text/xml;charset=iso-8859-1')
剛剛返回SoapVar
之前。 但是我仍然在http頭文件和soap響應中得到utf-8的編碼。
我已經嘗試了在stackoverflow中的答案,並在定義肥皂服務器時設置了encdoding類型的答案,但這並沒有爲我工作。
你能幫我嗎。 在此先感謝。
Edit
: 這是肥皂服務器響應的原始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
:
我發現有關於編碼類型SOAP服務器響應的PHP錯誤報告。最新評論說,有一個錯誤是在2008年。 這裏是鏈接:php bug
任何人都可以驗證他們是否有類似的問題,肥皂服務器編碼?
如果任何人有任何經驗,請幫忙 –