1

我有一组要发送到 SOAP 客户端的数据。一切正常,但没有传输一条数据,正如 __getLastRequest() 所揭示的那样。

这是我的代码

<?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" => "xxxx.xxxx@gmail.com"
      ),
      "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";

Retailed[0]['dealerCode'] 是发送的 XML 中唯一省略的信息。

有任何想法吗?

非常感谢。

4

1 回答 1

2

正如 mac 所说,格式化代码会很好,但我注意到的一件事是“零售商”字段是唯一大写的字段。不确定 WSDL 是否对客户端发送的内容有任何影响,但它可能。

仔细检查 WSDL 并查看该字段是否应该改为“零售商”。顺便说一句,您有机会分享 WSDL 吗?

编辑在查看 WSDL 之后,“零售商”是要走的路:

<s:element minOccurs="0" maxOccurs="1" name="retailer" type="tns:Retailer"/>

有效载荷的格式也应该不同,它应该是

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

根据 WSDL

<s:complexType name="Retailer">      
    <s:attribute name="dealerCode" type="s:string"/>        
</s:complexType>
于 2011-12-11T21:45:25.037 回答