PHP SOAP XML请求

时间:2016-04-06 22:28:21

标签: php xml soap

我有这个XML,它可以在soapUi中运行

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:web="xxx" xmlns:data="xxx">
   <soapenv:Header/>
   <soapenv:Body>
      <web:FindArticles>
         <web:request>
            <data:culture_id>de-DE</data:culture_id>  
            <data:vehicle_search_parameters>    
               <data:address>
                  <!--Optional:-->
                  <data:countries>
                     <!--Zero or more repetitions:-->
                     <data:country_id>D</data:country_id>
                  </data:countries>
                  <!--Optional:-->
               </data:address>
               <data:dealer_id>XXX</data:dealer_id>
            <data:show_dealer_vehicles>true</data:show_dealer_vehicles>
            </data:vehicle_search_parameters>
         </web:request>
      </web:FindArticles>
   </soapenv:Body>
</soapenv:Envelope>

但我无法理解如何通过PHP调用它。我正在尝试这样的事情,但得到错误......

<?php
$wsdl = 'XXX';

$options = array(
    'login' => 'XXX',
    'password' => 'XXX',
    'trace'=>true
);

$params = array(
    'culture_id' => 'de-DE',
    'country_id' => 'D',
    'dealer_id' => 'XXX',
    'show_dealer_vehicles' => true
);


try {
    $soap = new SoapClient($wsdl, $options);
    $data = $soap->FindArticles($params);
}
catch(Exception $e) {
    die($e->getMessage());
}

var_dump($data);
die;

看起来,有某种嵌套函数 - 我如何通过PHP调用它?我尝试过类似$ soap-&gt; FindArticles(&#39;请求&#39;,$ params),但它仍然不起作用

0 个答案:

没有答案