How to send parameters by the soap header and together parameters for the body

0

I'm wondering how I send the header of a soap and next to the parameter that goes to the body. I'm putting the code I've already done and the soap:

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"                 xmlns:xsd="http://www.w3.org/2001/XMLSchema"  xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Header>
<Seguranca xmlns="http://satussistemas.org/">
  <Usuario>string</Usuario>
  <Senha>string</Senha>
</Seguranca>
</soap:Header>
<soap:Body>
<pegaArquivoAutomacao xmlns="http://satussistemas.org/">
  <nomeArquivo>string</nomeArquivo>
</pegaArquivoAutomacao>
</soap:Body>
</soap:Envelope>

And here's the code:

$client = new SoapClient('Meu WSDL',array());

$auth = array('Seguranca'=>array('Usuario'=>'usuario', 
                                         'Senha'=>'senha')); 

$header = new SoapHeader('pegaArquivoAutomacao','Seguranca',$auth,true);

try{
   $resultProduto = $client->__setSoapHeaders($header);
   print_r($resultProduto);
}
   catch (SoapFault $exceptionProduto) {
   echo $exceptionProduto;      
}
    
asked by anonymous 11.01.2017 / 20:56

0 answers