2017-05-31 11 views
1

私のphp soapclientプロジェクトに問題があります。 これまではsoapリクエストを送信するためにカールを使用していましたが、さまざまな理由からPHPの統合されたsoapクライアントを使用する必要があります。PHP SOAP - 複数のネームスペースを持つクライアント

私の私はCURLを使用(作業)要求がこのように見えた:

<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:asc="http://asc.ws.ideal.com" xmlns:xsd="http://getserviceeventstatus.info.asc.ws.ideal.com/xsd"> 
    <soap:Header/> 
    <soap:Body> 
     <asc:getServiceEventStatus>   
     <asc:param>  
      <xsd:info>    
       <xsd:includePreviousEventsInfo>true</xsd:includePreviousEventsInfo>    
       <xsd:mainAscReferenceId>16111294</xsd:mainAscReferenceId>   
      </xsd:info>   
      <xsd:password>xxx</xsd:password>    
      <xsd:userId>xxx</xsd:userId> 
     </asc:param> 
     </asc:getServiceEventStatus> 
    </soap:Body> 
</soap:Envelope> 

私の実際のPHPスクリプトは、そのように見えます...

 <?php 
error_reporting(E_ALL); 

$wsdl = '/services/AscServiceSync?wsdl'; 
$location = '/services/AscServiceSync.AscServiceSyncHttpSoap11Endpoint/'; 

$options = array(
'uri'=>'http://schemas.xmlsoap.org/soap/envelope/', 
'style'=>SOAP_RPC, 
'use'=>SOAP_ENCODED, 
'soap_version'=>SOAP_1_1, 
'cache_wsdl'=>WSDL_CACHE_NONE, 
'connection_timeout'=>15, 
'trace'=>true, 
'encoding'=>'UTF-8', 
'exceptions'=>true, 
"location"=>$location 
); 

$client = new SoapClient($wsdl, $options); 
$result = $client->getServiceEventStatus(array('userId' => 'xxx', 'password' => 'xxx', 'mainAscReferenceId' => '16111294')); 
var_dump ($result); 
print '<br />'; 
print $result->success; 
print '<br />'; 

?> 

サーバーがそのエラーメッセージを返します"param"または "info"のデータがありません

誰かが私を助けてくれるでしょう ありがとうございました!

+0

Fiddler2や他のパケットスニッファを使用して、送信しているものを確認できますか?それはあなたに違いを表示します。 –

答えて

0

一つのバグは、あなたが設定されていないことかもしれませんincludePreviousEventsInfo =>真

シオマネキトレースは、「情報」ノード内のこととmainAscReferenceIdを置く何かをする必要のような、他の相違点を示します。いくつかのHTTPSサイトでは、フィドラーはトラフィックの途中でデコードするために人のために偽の証明書をインストールするよう提案します。

また、送信された内容を確認するためにHTTPを受け付ける他のサイトにリクエストを送信することもできます。

0

私は自分のサーバーにリクエストを送り、wiresharkでパッケージを検査しました。

がサーバーに送信いただきました!厥:

<?xml version="1.0" encoding="UTF-8"?> 
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://asc.ws.ideal.com"><SOAP-ENV:Body><ns1:getServiceEventStatus/></SOAP-ENV:Body></SOAP-ENV:Envelope> 

私はまた、「includePreviousEventsInfo」付加価値をそれがすべてで助けdoes notの。 "userId"の代わりに "param"を入れたときにサーバーのエラーメッセージが "info"に変更されていることがわかりました。userIdを "info"に変更するとエラーメッセージが "param"に変更されます...

0

あなたのwireshark xmlレスポンスから見たように、soapClientはあなたの問題で言及した正確なXMLリクエストを送信していません。最後に生成されたXMLを下の行でチェックし、それをデバッグすることもできます。

$res = $client->__getLastRequest(); 

SOAPサーバーに複数のネストされたXMLリクエストが必要です。これは、多次元配列を渡すことで生成できます。

$reqArr = [ 
    'info' => [ 
     'includePreviousEventsInfo' => true, 
     'mainAscReferenceId' => 16111294 
    ], 
    'password' => 'xxxxxx', 
    'userId' => 'xxxxxx', 
]; 

$res = $client->__soapCall('getServiceEventStatus', $reqArr); 

エラーが発生する場合は、上記の方法で最後にリクエストしたXMLを確認してください。

希望します。

関連する問題