0

私の SOAP サーバーは、応答ヘッダーで Content-Type: text/html を送信します。Content-type: text/xml が必要です。

public function index()
{
    $this->layout = 'soap';
    ini_set("soap.wsdl_cache_enabled", "0");
    $this->server = new SoapServer('wsdl/tur.wsdl', array(
            'soap_version' => SOAP_1_2, 
    ));
    $this->server->setObject($this);
    $this->server->handle();
}

サーバーの応答は次のとおりです。

HTTP/1.1 200 OK
日付: 2012 年 3 月 19 日月曜日 12:17:10 GMT
サーバー: Apache/2.2.20 (Ubuntu)
X-Powered-By: PHP/5.3.6-13ubuntu3.6
Set-Cookie: CAKEPHP=msmid2fijgrj1efjs0otl8qfj1 ; expires=Mon, 19-Mar-2012 16:17:10 GMT; path=/
P3P: CP="NOI ADM DEV PSAi COM NAV OUR ORo STP IND DEM"
Vary: Accept-Encoding
Content-Encoding: gzip
Content-Length: 877
Content-Type: text/html ; 文字セット=UTF-8

text/xml コンテンツ タイプで header() を呼び出そうとしました

public function index()
{
    $this->layout = 'soap';
    ini_set("soap.wsdl_cache_enabled", "0");

    header("Content-Type: text/xml");

    $this->server = new SoapServer('wsdl/tur.wsdl', array(
        'soap_version' => SOAP_1_2, 
    ));
    $this->server->setObject($this);
    $this->server->handle();
}

SoapServer の構築前後ですが、結果はありません。

4

1 に答える 1

1

(質問の編集で回答。コミュニティ wiki の回答に変換。回答がない質問を参照してください。ただし、コメントで問題が解決されました (またはチャットで拡張されました) )

OP は次のように書いています。

解決しました、それは сakephp 機能でした。Cakephp でコンテンツ タイプを記述する方法に感謝します。

public function index()
{
    $this->layout = 'soap';
    ini_set("soap.wsdl_cache_enabled", "0");
    $this->server = new SoapServer('wsdl/tur.wsdl', array(
        'soap_version' => SOAP_1_2,
    ));
    $this->server->setObject($this);
    $this->server->handle();

    $this->RequestHandler->respondAs('text/xml');
}
于 2015-01-31T15:23:56.457 に答える