Problemas com cliente SOAP

88 views
Skip to first unread message

Paulo PHP

unread,
Jan 26, 2017, 11:30:35 AM1/26/17
to php-brasil
Olá,

Eu preciso me conectar a um web service que segue o seguinte envelope:

   <soap:Header xmlns:wsa="http://www.w3.org/2005/08/addressing">
      <token xmlns="http://CFOAB.Integracao">xxxxx</token>
   </soap:Header>  
   <soap:Body>
      <int:AdvogadoRegular>
         <!--Optional:-->
         <int:cpf>99999999999</int:cpf>
      </int:AdvogadoRegular>
   </soap:Body>
</soap:Envelope>

Abaixo segue o código PHP:

$client = new SoapClient( 'https://www5.oab.org.br/Integracao/CNA.svc?wsdl', $options = array( 'soap_version' => SOAP_1_2, 'trace'=>1, 'exceptions'=> 0) );

// NOME DA FUNÇÃO A SER EXECUTADA
$function = 'AdvogadoRegular';

// PARÂMETROS DA FUNÇÃO A SER EXECUTADA
$arguments= array('AdvogadoRegular' => array( 'cpf'  => '99999999999' ));

// URL DO WEB SERVICE
$options = array('location' => 'https://www5.oab.org.br/Integracao/CNA.svc');

// HEADER
$token = array(
'token'=> 'xxxxx',
);
$header = new SoapHeader("http://CFOAB.Integracao",'token',$token,false);
$client->__setSoapHeaders($header);

// EXECUTA A FUNÇÃO
$result = $client->__soapCall($function, $arguments, $options);

echo $result;


O resultado é um erro "SoapFault exception: [s:Erro no processamento] Problema interno no servidor.".

Acho que estou errando ao adicionar o header ao SOAP.

Alguém pode me ajudar com isso???

Reply all
Reply to author
Forward
0 new messages