0
I’m having doubts about how to pass the parameters to consume a webservice. The way I’m doing it, I got the error back down:
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 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? I am incorrectly passing the parameters?
Thanks in advance.
Try
$client->listaDadosCV($endereco)
instead of$client->__soapcall($function, $arguments)
– gmsantos
I did it the way you told me @gmsantos and also that way:
– Loan Motyl
I did it the way you told me @gmsantos and also this way: $result = $client->Inputcv($Arguments); But both did not work and the error continues.
– Loan Motyl
which error returns with $client->listDadosCV($address) ?
– gmsantos
The error below @gmsantos Fatal error: Uncaught Soapfault Exception: [Client] Function ("listDadosCV") is not a Valid method for this service is that the function on the server is inputCV
– Loan Motyl
Even q is developing the Soap server? it seems q ta error in it and it is encoding thing
– Paulo Victor