2011-12-09 3 views
1

SOAPクライアントに送信するデータの配列があります。 これはすべて動作しますが、__getLastRequest()によって明らかにされるように、1つのデータは送信されません。クライアントに送信する際のPHPおよびSOAPデータの損失

はここに私のコード

<?php 

    $test_array = array(
    "request" => array(
     "dateTime"   => "2011-12-05T11:37:06.0000000+00:00", 
     "brandId"   => 2, 
     "extSysId"   => 11, 
     "extSysPassword" => "xxxxx", 
     "customer"   => array(
     "title" => "Mr", 
     "firstName" => "Dec", 
     "lastName" => "Test-Two", 
     "address" => array(
      "type" => "Residential", 
      "pafValidated" => TRUE, 
      "houseNumber" => "xx", 
      "houseName" => "", 
      "line1" => "xx xx", 
      "line2" => "", 
      "line3" => "xx", 
      "line4" => "", 
      "line5" => "", 
      "postcode" => "xxx xxx" 
     ), 
     "phones" => array(
      0 => array(
      "type" => "Home", 
      "_" => "xxx xxxxxx" 
     ), 
      1 => array(
      "type" => "Work", 
      "preferred" => TRUE, 
      "_" => "" 
     ), 
      2 => array(
      "type" => "Mobile", 
      "preferred" => TRUE, 
      "_" => "" 
     ) 
     ), 
     "email" => "[email protected]" 
    ), 
     "nextPurchase" => array(
     "date" => "2014-05-01" 
    ), 
     "dataProtection" => array(
     "group" => FALSE, 
     "thirdParty" => FALSE 
    ), 
     "futureContactChannels" => array(
     0 => array(
      "type" => "Whitemail", 
      "option" => FALSE 
     ), 
     1 => array(
      "type" => "Email", 
      "option" => FALSE 
     ), 
     2 => array(
      "type" => "Phone", 
      "option" => FALSE 
     ), 
     3 => array(
      "type" => "SMS", 
      "option" => FALSE 
     ) 
    ), 
     "vehicleRequests" => array(
     0 => array(
      "derivativeCode" => "xxxxx", 
      "type" => "T" 
     ) 
    ), 
     "Retailer" => array(
     0 => array (
      "dealerCode" => "00082" 
     ) 
    ), 
     "company" => array(
     "companyName" => "", 
     "jobTitle" => "" 
    ), 
     "campaign" => array(
     "code" => "xxxxxxxxx", 
     "source" => 69 
    ), 
     "notes" => "blah balh: ." 
    ) 
); 

$client = new SoapClient("/xxx/xxxx/xxxxxx/xxxxx.wsdl", array(
    "login" => "xxx", 
    "password" => "xxx", 
    "location" => "http://xxx.xxx.xxx.xxx/xxxxxx/Some.asmx", 
    "uri" => "urn:xmethods-delayed-quotes", 
    'trace' => 1, 
    'exceptions' => 1, 
    'soap_version' => 'SOAP_1_1', 
    'encoding' => 'UTF-8', 
    'features' => 'SOAP_USE_XSI_ARRAY_TYPE' 
)); 


$client->CallComeFunction($test_array); 

echo "REQUEST:\n" . $client->__getLastRequest() . "\n"; 

echo "*************************************************\n"; 

echo "Response:\n" . $client->__getLastResponse() . "\n"; 

小売りだ[0] [ 'dealerCode']送信されたXMLから省略されている情報の唯一の作品です。

アイデア?

多くのありがとうございます。

+0

アイデア?今はちょうど1つです...あなたのコードを読みやすい形でフォーマットするのはどうですか? ;)真剣に:それがフォーマットされた方法で多くのケアを示していない質問は、OPが彼/彼女が気にしていたよりも答え/ upvotesを得る可能性が低いです! :) – mac

+0

あなたが私に大きな画面を購入した場合、あなたのコードを読むことができます;)。 – middus

答えて

2

Macは言うとおり、コードの書式設定はいいですが、私が気づくのは「小売業者」フィールドが大文字になっていることだけです。 WSDLがクライアントによって送信されるものに何らかの影響を与えるかどうかは不明ですが、それは可能性があります。

WSDLを再度確認し、代わりにフィールドが「小売業者」であるかどうかを確認します。あなたはWSDLを共有できますか?btw?

<s:element minOccurs="0" maxOccurs="1" name="retailer" type="tns:Retailer"/> 
は、ペイロードが同様に異なってフォーマットする必要があります

、それはWSDL

あたり

"retailer" => array(
    "dealerCode" => "00082" 
) 

次のようになります。

EDIT WSDLを確認した後、 '小売業者は' 進むべき道であります

<s:complexType name="Retailer">  
    <s:attribute name="dealerCode" type="s:string"/>   
</s:complexType> 
+0

php soapクライアントは、実際にはWSDLにフィールドが定義されていないデータを無視します。この回答は道を導くはずです! –

+0

@quickshiftin、Ratailerを 'retailer'に変更すると、「dealerCode not found」というエラーが発生しました。 WSDL [リンク](http://www.autorotation.org/tmp/test.wsdl)へのリンクはこちら フォーマットアップのご協力ありがとうございます – Shmoyko

関連する問題