2012-03-19 10 views
0

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

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
セットクッキー:CAKEPHP = msmid2fijgrj1efjs0otl8qfj1; expires = 2012年3月19日(月)16:17:10 GMT;パス=/
P3P:CP = "NOI ADM DEV PSAi COM NAV OUR OTRo STP IND DEM"
は変更される場合:受け入れ-エンコーディング
コンテンツエンコード:gzipで
のContent-Length:877
のContent-Typeを:text/html;文字セット= UTF-8私はtext/xmlでのconentタイプ前とのSoapServerを構築した後

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(); 
} 

、ない結果とヘッダを()を呼び出すことを試みてきました

+0

のおかげで、こので働いたことはありませんが、documenationに 'のSoapServer :: addSoapHeader'あなたはContent-Typeのを上書きすることを試してみましたが?あり – arma

+0

'handle'のための文書のコメントによると、" ... 'SoapServer :: handle();'メソッドはブラウザに追加のHTTPヘッダーを送ります。その1つは 'Content-Type:application/soap + xml' "本当に答えはありませんが、いくつかの洞察を提供するかもしれません。 – Travesty3

答えて

0

(。。質問の編集に回答コミュニティのwikiの答えに変換Question with no answers, but issue solved in the comments (or extended in chat)を参照してください)

ザ・OPが書いた:解決

を、それがсakephpの機能でした。 How to write content type in 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'); 
} 
関連する問題