Request of xml Soap

Asked

Viewed 110 times

0

Hello it will be possible to make this code another way in php and in Delphi if yes thanks help I don’t know if I should do so the requests I appreciate a tips Soap is not my strong

    $request = '
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:tem="http://tempuri.org/" xmlns:a="http://www.w3.org/2005/08/addressing">
   <soap:Header>
   <a:Action soap:mustUnderstand="1">http://tempuri.org/IWSClientes/envioExcelCarteiraClientes</a:Action>
   <SecurityToken xmlns="ns">   ehTpkDFKUhKIkShjIH9Zcv0xAHRoZ4sfc7HgNrqrfDiFBt/FFD3EEX9IqXZiPd7Zwcrr4VUUAZTbw
   ls4MIHEMTnuBLaFyee0bOPSnnvavvutKG2NSTdy9XqHnkxk/mFJXDC2+LsJ+3DuOvpFbfuvHEr
 ZbsP36gjarXpAnaHwbNWJvFHPcNMLStmE9eRwxbFQ==L9+zby7w1V5OZTVGUPLZ1x8rJYzCEHAnxovPUuyadZFdbv21el
   Z1qsvyp3kzbVR2s155E/Fea+8tXySxU7XfCMlut2mQ/YxvqzeQNIAc5JF99688MPfwqt
</SecurityToken>
   <a:To soap:mustUnderstand="1">https://servicebusq.lusitania.pt/Clientes/Servicos/WSClientes.svc/WSClientes.svc</a:To>
   </soap:Header>
   <soap:Body>
      <tem:envioExcelCarteiraClientes>
         <!--Optional:-->
         <tem:CompanhiaConexao>1026</tem:CompanhiaConexao>
      </tem:envioExcelCarteiraClientes>
   </soap:Body>
</soap:Envelope>';
$headers = array(
    'Content-Type: application/soap+xml;charset=UTF-8;',

);

// Cria o objeto cURL e define as propriedades por defeito
$soap_do = curl_init();
curl_setopt($soap_do, CURLOPT_URL, 'https://servicebusq.lusitania.pt/Clientes/Servicos/WSClientes.svc/WSClientes.svc');
curl_setopt($soap_do, CURLOPT_CONNECTTIMEOUT, 10);
curl_setopt($soap_do, CURLOPT_TIMEOUT, 10);
curl_setopt($soap_do, CURLOPT_HTTPHEADER, $headers);
curl_setopt($soap_do, CURLOPT_HTTPAUTH, CURLAUTH_NTLM);
curl_setopt($soap_do, CURLOPT_USERPWD, "user:!teste#"); //Your credentials goes here
curl_setopt($soap_do, CURLOPT_RETURNTRANSFER, true);
curl_setopt($soap_do, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($soap_do, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($soap_do, CURLOPT_POST, true);
curl_setopt($soap_do, CURLOPT_POSTFIELDS, $request);
$curlResponse = curl_exec($soap_do);


 print_r($curlResponse);

$data = curl_exec($soap_do); 
if(!$data){
    print_r('ERROR: ' . curl_error($ch));
}

curl_close($soap_do);
  • Have you tried using Soapclient?

  • I’ve used ...in Delphi is that I can’t always get authentication error I’m using httprio...no before meto la xml code and change the request should not give?

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.