phpsoapwsdlsoap-client

WSDL interpret supposed operation parameters


I'm trying to invoke this operation getCountries but I can't figure out reading the WSDL file which parameters are needed and in which structured way:

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

I've already tried with:

$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
)    

But it seems I'm not matching the specs, since I'm getting a "[Server was unable to process request. ---> Object reference not set to an instance of an object.]"

The final request with SoapClient::__getLastRequest is:

<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>

Edit, Solution:

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

Solution

  • wich parameters are needed and in which structured way:

    You can use the soapUI-tool for generating a valid soap-request and response.

    I propose to compare your soap-request (by logging it) with the one generated by 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>