Reputation: 21
Can someone help me?
I can not perform the AdvogadoRegular function in this web service.
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:int="https://www5.oab.org.br/integracao/">
<soap:Header xmlns:wsa="http://www.w3.org/2005/08/addressing">
<token xmlns="http://CFOAB.Integracao">xxxxxxxx</token>
<wsa:To>https://www5.oab.org.br/Integracao/CNA.svc</wsa:To>
</soap:Header>
<soap:Body>
<int:AdvogadoRegular>
<!--Optional:-->
<int:cpf>99999999999</int:cpf>
</int:AdvogadoRegular>
</soap:Body>
</soap:Envelope>
I try to access from that code.
// WSDL
$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'=> 'xxxxxxxx',
'wsa:To'=>'https://www5.oab.org.br/Integracao/CNA.svc',
);
$header = new SoapHeader("http://CFOAB.Integracao",'token',$token,false);
$client->__setSoapHeaders($header);
// EXECUTA A FUNÇÃO
$result = $client->__soapCall($function, $arguments, $options);
echo $result;
I think the error happens when I try to send the header. Please help me...
Upvotes: 2
Views: 513
Reputation: 760
first I would advise you to use a WSDL to php generator such as PackageGenerator, then regarding your header, it seems it's a WsSecurity header that you have to send, so you should try using the WsSecurity project that eases the way to add this type of header
Upvotes: 1