代码之家  ›  专栏  ›  技术社区  ›  javier_domenech

WSDL解释超操作参数

  •  1
  • javier_domenech  · 技术社区  · 8 年前

    我正在尝试调用这个操作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 回复  |  直到 8 年前
        1
  •  2
  •   Aydin K.    8 年前

    需要wich参数,并且以结构化方式:

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

    我建议将您的soap请求(通过记录)与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>