I'm wondering how to pass parameters to consume a webservice. The way I'm doing, I have the error below:
Fatal error: Uncaught SoapFault exception: [Client] SOAP-ERROR: Encoding: object hasn't 'ListaDadosCV' property in /srv/www/htdocs/wwwintranet/nusoap_ex/sap_xml.php:250 Stack trace: #0 /srv/www/htdocs/wwwintranet/nusoap_ex/sap_xml.php(250): SoapClient->__soapCall('InputCV', Array) #1 {main} thrown in /srv/www/htdocs/wwwintranet/nusoap_ex/sap_xml.php on line 250
The wsdl file:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:cv="http://agraria.com/po/hcm/cv">
<soapenv:Header/>
<soapenv:Body>
<cv:MT_CV_INBOUND_Request>
<ListaDadosCV>
<Endereco>
<Numero>?</Numero>
<Complemento>?</Complemento>
<Bairro>?</Bairro>
<Cidade>?</Cidade>
<CEP>?</CEP>
<Estado>?</Estado>
<Celular>
<Tipo>?</Tipo>
<Numero>?</Numero>
</Celular>
<Residencial>
<Tipo>?</Tipo>
<Numero>?</Numero>
</Residencial>
<Comercial>
<Tipo>?</Tipo>
<Numero>?</Numero>
</Comercial>
<Email>?</Email>
</Endereco>
</ListaDadosCV>
</cv:MT_CV_INBOUND_Request>
</soapenv:Body>
</soapenv:Envelope>
The relevant part of the php code:
<?php
require_once('nusoap.php');
try {
$client = new soapclient(
'SI_CV_WS_Outb_SyncService.wsdl',
array(
'proxy_host' => "mv114.agraria.coop.br",
'proxy_port' => 50000,
'proxy_login' => "WSPO",
'proxy_password' => "WAgr9876",
'trace' => 1,
'exceptions' => true,
'cache_wsdl' => WSDL_CACHE_NONE
)
);
} catch (Exception $e) {
echo $e->getMessage();
}
$Endereco = array(
'Numero' => '?',
'Complemento' => '?',
'Bairro' => '?',
'Cidade' => '?',
'CEP' => '?',
'Estado' => '?',
'Celular' => array(
'Tipo' => '?',
'Numero' => '?'
),
'Residencial' => array(
'Tipo' => '?',
'Numero' => '?'
),
'Comercial' => array(
'Tipo' => '?',
'Numero' => '?'
),
'Email' => '?'
);
$function = 'InputCV';
$ListaDadosCV = array(
$Endereco,
);
$MT_CV_INBOUND_Request = array('ListaDadosCV' => $ListaDadosCV);
$arguments = $MT_CV_INBOUND_Request;
$result = $client->__soapcall($function, $arguments);
?>
Why are you making this mistake? Am I passing the parameters incorrectly?
Thank you in advance.