PHP のネイティブ SOAP サーバー クラスを使用して、PHP で SOAP サーバーを作成しました。必要なエンコーディングはISO-8859-1
. 次のように石鹸サーバーを作成しながら、私はそれをやろうとしました:
$server = new SoapServer('./AdviseAndPay.wsdl',array('encoding'=>'ISO-8859-1'));
ただし、http ヘッダーと SOAP 応答のエンコーディングは依然として utf-8 です。
SoapVar
SOAP応答のネイティブ 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
:
SOAP サーバー応答のエンコーディング タイプに関する php バグ レポートがあったことがわかりました。バグがあったという最新のコメントは2008年でした。リンクは次のとおりです:phpバグ
ソープサーバーのエンコーディングに同様の問題があるかどうかを誰かが確認できますか?