Advertisement
Guest User

Test2 PHP SOAP

a guest
Aug 23rd, 2019
170
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.77 KB | None | 0 0
  1. <?php
  2. $wsdl = "http://irusalserver.dns-dns.com/eComerce/Servicio.asmx";
  3.  
  4. $xml = '<?xml version="1.0" encoding="utf-8"?>
  5. <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/">
  6.  <soap:Body>
  7.    <GenerarVenta xmlns="http://tempuri.org/">
  8.      <venta>
  9.        <VentaDT>
  10.            <Encabezado>
  11.                <FechaEntrega type="xs:dateTime">2019-08-27T12:20:00</FechaEntrega>
  12.                <Amex type="xs:decimal">0</Amex>
  13.                <Tarjeta type="xs:decimal">899</Tarjeta>
  14.            </Encabezado>
  15.            <Cuerpo>
  16.                <Producto_Id type="xs:string">013059</Producto_Id>
  17.                <Cantidad type="xs:decimal">1</Cantidad>
  18.                <Precio type="xs:decimal">899</Precio>
  19.            </Cuerpo>
  20.        </VentaDT>
  21.      </venta>
  22.    </GenerarVenta>
  23.  </soap:Body>
  24. </soap:Envelope>';
  25.  
  26. $headers = array(            
  27.     "Content-type: text/xml; charset=utf-8",
  28.     "Cache-Control: no-cache",
  29.     "Pragma: no-cache",
  30.     "SOAPAction: \"http://tempuri.org/GenerarVenta\"",
  31.     "Content-length: ".strlen($xml),
  32. );
  33.  
  34. $soap_do = curl_init();
  35. curl_setopt($soap_do, CURLOPT_URL,            $wsdl);  
  36. curl_setopt($soap_do, CURLOPT_CONNECTTIMEOUT, 10);
  37. curl_setopt($soap_do, CURLOPT_TIMEOUT,        10);
  38. curl_setopt($soap_do, CURLOPT_RETURNTRANSFER, true );
  39. curl_setopt($soap_do, CURLOPT_SSL_VERIFYPEER, false);  
  40. curl_setopt($soap_do, CURLOPT_SSL_VERIFYHOST, false);
  41. curl_setopt($soap_do, CURLOPT_POST,           true );
  42. curl_setopt($soap_do, CURLOPT_POSTFIELDS,     $xml);
  43. curl_setopt($soap_do, CURLOPT_HTTPHEADER,     $headers);
  44.  
  45. $result = curl_exec($soap_do);
  46. $err = curl_error($soap_do);
  47.  
  48. var_export($result);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement