3
I am consuming an external webservice via PHP and the same requests authentication in a different way, the login and password has to be passed within XML. But I can’t authenticate.
The call for service is being created the way below.
public static function myFunction ($param){
$soapClient = new \SoapClient('my_wsdl', [
"trace" => 1,
"exception" => 0,
'Login' => '*',
'Senha' => '*'
]);
return($soapClient->myService($param));
}
The service expects an XML as below:
<soapenv:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:api="meu_endereco_api">
<soapenv:Header>
<Autenticacao>
<Login>*****</Login>
<Password>****</Senha>
</Autenticacao>
</soapenv:Header>
<soapenv:Body>
<api:minha_api soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<meu_parametro xsi:type="xsd:string">$param</meu_parametro>
</api:minha_api>
</soapenv:Body>
</soapenv:Envelope>
The service returns me authentication error:
object(stdClass)[783] public 'Parametro' => string 'ERRO NAO AUTENTICADO'
Does anyone have any idea how to send the authenticated request the parameters in this expected format?