I'm in need of some help.
I'm trying to make a communication between a PHP page and SOAP from a third-party company, but I have tried a number of ways and I can not resolve it.
At the time of sending the XML it is automatically putting tags automatically even though I do not insert it in my code.
What can it be?
below example of the codes I'm working on
function atualizacaoCadastralXML(){
global $log, $client, $parceria, $connMS, $connSY;
$client = new SoapClient('http://cia-118:8080/g5-senior-services/rubi_Synccom_senior_g5_rh_fp_fichaComplementar?wsdl', array('soap_version' => SOAP_1_2,
'trace' => 1,
'exceptions' => 0,
'use' => SOAP_LITERAL,
'style' => SOAP_DOCUMENT));
$user = 'nome.sobrenome';
$data = soapify(array(
"user" => $user,
'parameters' => array(
'numcad' => '123456',
'numemp' => 1,
'TipOpe' => 'A',
'TipCol' => 1
),
));
$method = 'FichaComplementar_7';
$result = $client->$method(new SoapParam($data, 'Data'));
echo "<pre>";
echo print_r(htmlentities($client->__getLastRequest()));
echo "</pre>";
die();
}
function soapify(array $data){
foreach ($data as &$value){
if (is_array($value)){
$value = soapify($value);
}
}
return new SoapVar($data, SOAP_ENC_OBJECT);
}
The return of the above code is the following, notice that at no time do I pass anything related to user, password and encritpion.
<?
xml version="1.0" encoding="UTF-8"?>
<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope"
xmlns:ns1="http://services.senior.com.br">
<env:Body>
<ns1:FichaComplementar_7>
<user>
<user>nome.sobrenome</user>
<parameters>
<numcad>123456</numcad>
<numemp>1</numemp>
<TipOpe>A</TipOpe>
<TipCol>1</TipCol>
</parameters>
</user><password/>
<encryption/>
<parameters/>
</ns1:FichaComplementar_7>
</env:Body>
</env:Envelope>