2010-11-18 7 views
1

私はクライアントとして接続するサードパーティの仕様に合わせてWebサービスを構築しようとしていますが、サービスはPHPで書かれていなければなりませんが、少し。基本的に私の応答は要素に包まれていますが、クライアントはこれにより私の応答を受け入れていません。ここでは例です。クライアントが期待している何PHP石鹸サービスevenlope <return>要素

service.php

<?php 


class MyService { 

    public function Ping() { 
     return date('d/m/Y H:i:s'); 
    } 

} 


$server = new SoapServer(null, array('soap_version' => SOAP_1_2, 'encoding' => 'UTF-8', 'uri' => 'http://tempuri.org/')); 
$server->setClass("MyService"); 
$server->handle(); 

?> 

要求

<soapenv:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
     xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
     xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" 
     xmlns:tem="http://tempuri.org/"> 
    <soapenv:Header/> 
    <soapenv:Body> 
     <tem:Ping /> 
    </soapenv:Body> 
</soapenv:Envelope> 

応答

<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://tempuri.org/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"> 
    <SOAP-ENV:Body> 
     <ns1:PingResponse> 
     <return xsi:type="xsd:string">18/11/2010 18:51:02</return> 
     </ns1:PingResponse> 
    </SOAP-ENV:Body> 
</SOAP-ENV:Envelope> 

はPingResponseがちょうど日付が含まれているが、外に巻き付けずにすることです。これを行うにはどうすればPHP SoapClientを入手できますか?

など。

<ns1:PingResponse>18/11/2010 18:51:02</ns1:PingResponse> 
+0

普通のXMLで返信しようとしましたか? – stillstanding

答えて

0

私はあなたができるとは思わない、私はそれはあなたのクライアントは回避する必要があります何かですので、これはSOAPのコアに書かれていると思います。彼らがすでにPingResponseの内容を取得している場合、私はそれがより深く1ツリーを応答に移すのがはるかに困難であることはわかりません。

関連する問題