WSDL解释上面提到的操作参数

时间:2017-01-31 11:33:29

标签: php soap wsdl soap-client

我试图调用此操作getCountries,但我无法弄清楚需要参数的WSDL文件以及结构化方式:

http://webservice.nizacars.es/Rentway_WS/getCountries.asmx?WSDL

我已经尝试过:

$this->soap_client->getCountries(
  array(
    'countriesRequest' => array(
      'companyCode' => $this->login,
      'allCountries' => true
     )
  )
)

$this->soap_client->getCountries(
  array(
      'companyCode' => $this->login,
      'allCountries' => true
  )
)


$this->soap_client->getCountries(
      'companyCode' => $this->login,
      'allCountries' => true
)    

但似乎我不符合规格,因为我得到了一个" [服务器无法处理请求。 --->对象引用未设置为对象的实例。] "

SoapClient :: __ getLastRequest的最终请求是:

<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://www.jimpisoft.pt/Rentway_Reservations_WS/getCountries">
<SOAP-ENV:Body>
<ns1:getCountries/>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>

修改,解决方案

$data = array(
                'getCountries' => array(
                    'objRequest' => array(
                        'companyCode' => $this->login,
                        'allCountries' => true
                    )
                )
            );
$result = @$this->_client->__call('getCountries',$data);

1 个答案:

答案 0 :(得分:2)

  
    

需要哪些参数以及结构化方式:

  

您可以使用soapUI工具生成有效的soap请求和响应。

我建议将您的soap-request(通过记录)与soapUI生成的请求进行比较:

<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:get="http://www.jimpisoft.pt/Rentway_Reservations_WS/getCountries">
   <soap:Header/>
   <soap:Body>
      <get:getCountries>
         <!--Optional:-->
         <get:objRequest>
            <!--Optional:-->
            <get:companyCode>?</get:companyCode>
            <get:allCountries>?</get:allCountries>
         </get:objRequest>
      </get:getCountries>
   </soap:Body>
</soap:Envelope>
相关问题