2012-05-04 4 views
4

空のstdclassオブジェクトを取得する理由がわかりません。ここでSOAPクライアントが空のstdclassを受け取っています

はコードです:

$client = new Zend_Soap_Client('http://urltocodethatgenerateswsdl?wsdl', $options); 
$result = $client->sayHello(array('who' => 'Heidi')); 
Zend_Debug::dump($client->getLastResponse()); 
Zend_Debug::dump($result); 

は、ここで私はlastResponseために得るものです:?

<?xml version="1.0" encoding="UTF-8"?> 
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://urltocodethatgenerateswsdl"> 
    <SOAP-ENV:Body> 
     <ns1:sayHelloResponse> 
      <return>Say Hello Heidi</return> 
     </ns1:sayHelloResponse> 
    </SOAP-ENV:Body> 
</SOAP-ENV:Envelope> 

そしてここでは、$結果

object(stdClass)#23 (0) {} 

なぜそれがあるのダンプですか誰かが説明できますか?

UPDATE:(自動的にZendの使用のAutoDiscoveryによって生成された)を追加しましたWSDL事前に

<definitions xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:tns="http://clxpreview.ch/index/soap" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap-enc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" name="Service_Soap" targetNamespace="http://clxpreview.ch/index/soap"> 
<types> 
    <xsd:schema targetNamespace="http://urltocodethatgenerateswsdl"> 
     <xsd:complexType name="User"> 
      <xsd:all> 
       <xsd:element name="username" type="xsd:string" nillable="true"/> 
       <xsd:element name="password" type="xsd:string" nillable="true"/> 
      </xsd:all> 
     </xsd:complexType> 
    </xsd:schema> 
</types> 
<portType name="Service_SoapPort"> 
    <operation name="getSystemTime"> 
     <documentation>getSystemTime</documentation> 
     <input message="tns:getSystemTimeIn"/> 
     <output message="tns:getSystemTimeOut"/> 
    </operation> 
    <operation name="sayHello"> 
     <documentation>sayHello</documentation> 
     <input message="tns:sayHelloIn"/> 
     <output message="tns:sayHelloOut"/> 
    </operation> 
    <operation name="getUser"> 
     <documentation>setUser</documentation> 
     <input message="tns:getUserIn"/> 
     <output message="tns:getUserOut"/> 
    </operation> 
    <operation name="setUser"> 
     <documentation>setUser</documentation> 
     <input message="tns:setUserIn"/> 
     <output message="tns:setUserOut"/> 
    </operation> 
</portType> 
<binding name="Service_SoapBinding" type="tns:Service_SoapPort"> 
    <soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/> 
    <operation name="getSystemTime"> 
     <soap:operation soapAction="http://urltocodethatgenerateswsdl#getSystemTime"/> 
     <input> 
      <soap:body use="literal" namespace="http://urltocodethatgenerateswsdl"/> 
     </input> 
     <output> 
      <soap:body use="literal" namespace="http://urltocodethatgenerateswsdl"/> 
     </output> 
    </operation> 
    <operation name="sayHello"> 
     <soap:operation soapAction="http://urltocodethatgenerateswsdl#sayHello"/> 
     <input> 
      <soap:body use="literal" namespace="http://urltocodethatgenerateswsdl"/> 
     </input> 
     <output> 
      <soap:body use="literal" namespace="http://urltocodethatgenerateswsdl"/> 
     </output> 
    </operation> 
    <operation name="getUser"> 
     <soap:operation soapAction="http://urltocodethatgenerateswsdl#getUser"/> 
     <input> 
      <soap:body use="literal" namespace="http://urltocodethatgenerateswsdl"/> 
     </input> 
     <output> 
      <soap:body use="literal" namespace="http://urltocodethatgenerateswsdl"/> 
     </output> 
    </operation> 
    <operation name="setUser"> 
     <soap:operation soapAction="http://urltocodethatgenerateswsdl#setUser"/> 
     <input> 
      <soap:body use="literal" namespace="http://urltocodethatgenerateswsdl"/> 
     </input> 
     <output> 
      <soap:body use="literal" namespace="http://urltocodethatgenerateswsdl"/> 
     </output> 
    </operation> 
</binding> 
<service name="Service_SoapService"> 
    <port name="Service_SoapPort" binding="tns:Service_SoapBinding"> 
     <soap:address location="http://urltocodethatgenerateswsdl"/> 
    </port> 
</service> 
<message name="getSystemTimeIn"/> 
<message name="getSystemTimeOut"> 
    <part name="return" type="xsd:string"/> 
</message> 
<message name="sayHelloIn"> 
    <part name="who" type="xsd:string"/> 
</message> 
<message name="sayHelloOut"> 
    <part name="return" type="xsd:string"/> 
</message> 
<message name="getUserIn"> 
    <part name="uid" type="xsd:int"/> 
</message> 
<message name="getUserOut"> 
    <part name="return" type="tns:User"/> 
</message> 
<message name="setUserIn"> 
    <part name="user" type="tns:User"/> 
</message> 
<message name="setUserOut"> 
    <part name="return" type="xsd:string"/> 
</message> 
</definitions> 

おかげ

ケルビン

+0

AFAIKあなたはしないでください。 – hakre

+0

サービスはネイティブの 'SoapClient'で動作しますか? WSDLを投稿してください。それは問題の可能性があります。サービスが正しいデータを返している可能性がありますが、WSDLが不良な場合はSOAPクライアントが見つからないことがあります。 – MrCode

+0

がWSDLを追加しました。 – Kel

答えて

0

この記事は、同じ問題が議論のように思える:

Return object with Zend_Soap

引用:

クライアントで 'classmap'オプション変数を渡す必要があります。 オプション配列に渡される 'classmap'オプションについてはhttp://www.php.net/manual/en/soapclient.soapclient.phphttp://www.php.net/manual/en/soapclient.soapclient.phpの両方を参照してください。 基本的には、クラスをWSDLファイルの返されたオブジェクトとして定義されたクラスにマッピングする配列である必要があります。

ルシアン

+0

あなたの投稿をありがとう。私はクラスマップを使用していました。この問題は、WSDLをキャッシュすることと関係していました。 – Kel

2

私はそれが働いていなかった理由を発見しました。私はに設定してのキャッシングをオフにして、私が行ったリクエストでキャッシュしないオプションを追加しなければなりませんでした。

どちらかini_setを使用することにより、またはあなたのphp.iniに変更を加えることにより、無効キャッシュ:

ini_set("soap.wsdl_cache_enabled", 0); 

私はまた私の要求に次のオプションパラメータを追加しました:

array('cache_wsdl' => WSDL_CACHE_NONE) 

ここでの記事です私はStackoverflowで見つけた: In PHP how can you clear a WSDL cache?

関連する問題