title: SOAP XML call using PHP curl?
body: <p>I have one SOAP WSDL api and i have a test api access.</p>
  
  <p>My SOAP Url : <a href="https://development.avinode.com/avinode/AvinodeIntegrationWeb/ws/EmptyLegFlightDemand.ws?wsdl" rel="nofollow">https://development.avinode.com/avinode/AvinodeIntegrationWeb/ws/EmptyLegFlightDemand.ws?wsdl</a></p>
  
  <p>i need to call and get the details from this url. i must send my username and password into this api call. so i tried to build the code. the code is given below.</p>
  
  <pre><code>    &lt;?php  
  $soapUrl='https://development.avinode.com:443/avinode/AvinodeIntegrationWeb/ws/EmptyLegDownload.ws?wsdl';
  $xml_post_string='&lt;S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:xs="http://www.w3.org/2001/XMLSchema"&gt;
      &lt;S:Header&gt;
          &lt;To xmlns="http://www.w3.org/2005/08/addressing"&gt;https://development.avinode.com/avinode/AvinodeIntegrationWeb/ws/EmptyLegDownload.ws&lt;/To&gt;
          &lt;Action xmlns="http://www.w3.org/2005/08/addressing"&gt;http://www.avinode.com/integration/EmptyLegDownload#request&lt;/Action&gt;
          &lt;ReplyTo xmlns="http://www.w3.org/2005/08/addressing"&gt;
              &lt;Address&gt;http://www.w3.org/2005/08/addressing/anonymous&lt;/Address&gt;
          &lt;/ReplyTo&gt;
          &lt;FaultTo xmlns="http://www.w3.org/2005/08/addressing"&gt;
              &lt;Address&gt;http://www.w3.org/2005/08/addressing/anonymous&lt;/Address&gt;
          &lt;/FaultTo&gt;
          &lt;MessageID xmlns="http://www.w3.org/2005/08/addressing"&gt;uuid:6a456287-923e-458e-9ccb-f900307f2b0f&lt;/MessageID&gt;
          &lt;wsse:Security S:mustUnderstand="1"&gt;
              &lt;wsu:Timestamp xmlns:ns13="http://www.w3.org/2003/05/soap-envelope" xmlns:ns14="http://docs.oasis-open.org/ws-sx/ws-secureconversation/200512" wsu:Id="_1"&gt;
                  &lt;wsu:Created&gt;2014-10-17T15:45:42Z&lt;/wsu:Created&gt;
                  &lt;wsu:Expires&gt;2014-10-17T15:50:42Z&lt;/wsu:Expires&gt;
              &lt;/wsu:Timestamp&gt;
              &lt;wsse:UsernameToken xmlns:ns13="http://www.w3.org/2003/05/soap-envelope" xmlns:ns14="http://docs.oasis-open.org/ws-sx/ws-secureconversation/200512" wsu:Id="uuid_2da8da35-1c69-4f38-9899-ba6950c825f5"&gt;
                  &lt;wsse:Username&gt;MY_USERNAME&lt;/wsse:Username&gt;
                  &lt;wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText"&gt;PASSWORD&lt;/wsse:Password&gt;
              &lt;/wsse:UsernameToken&gt;
          &lt;/wsse:Security&gt;
      &lt;/S:Header&gt;
      &lt;S:Body&gt;
          &lt;ns3:request xmlns="http://www.avinode.com/core/CommonTypes" xmlns:ns2="http://www.avinode.com/services/EmptyLegDownload" xmlns:ns3="http://www.avinode.com/integration/EmptyLegDownload"&gt;
              &lt;ns2:product&gt;
                  &lt;name&gt;osiz&lt;/name&gt;
                  &lt;version&gt;1.0&lt;/version&gt;
              &lt;/ns2:product&gt;
              &lt;ns2:domain&gt;http://flightcomparision.osiztechnologies.com&lt;/ns2:domain&gt;
              &lt;ns2:locale&gt;en_US&lt;/ns2:locale&gt;
              &lt;ns2:currency&gt;USD&lt;/ns2:currency&gt;
              &lt;ns2:region&gt;AMERICA&lt;/ns2:region&gt;
              &lt;ns2:after&gt;2014-11-01T00:00:00Z&lt;/ns2:after&gt;
              &lt;ns2:before&gt;2014-12-01T00:00:00Z&lt;/ns2:before&gt;
              &lt;ns2:pax&gt;1&lt;/ns2:pax&gt;
              &lt;ns2:excludeBrokers&gt;false&lt;/ns2:excludeBrokers&gt;
              &lt;ns2:requireTailNumber&gt;false&lt;/ns2:requireTailNumber&gt;
          &lt;/ns3:request&gt;
      &lt;/S:Body&gt;
  &lt;/S:Envelope&gt;';
  
  
  
  
     $headers = array( 
     "Content-Type: text/xml;charset=UTF-8", 
     "Accept: gzip,deflate", 
     "Cache-Control: no-cache", 
     "Pragma: no-cache", 
     "SOAPAction: \"\"", 
     "Authorization: Basic $auth", 
     "Content-length: ".strlen($xml_post_string), 
     ); 
  
     // PHP cURL  for https connection with auth
     $ch = curl_init();
     curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
     curl_setopt($ch, CURLOPT_URL, $soapUrl);
     curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
     curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_ANY);
     curl_setopt($ch, CURLOPT_TIMEOUT, 500);
     curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 500);
     curl_setopt($ch, CURLOPT_MAXREDIRS, 12);
     curl_setopt($ch, CURLOPT_POST, true);
     curl_setopt($ch, CURLOPT_POSTFIELDS, $xml_post_string); // the SOAP request
     curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
     $ss = curl_getinfo($ch);
     //print_r($ss);
    // exit;
     $response = curl_exec($ch); 
     print_r($response);
     exit;
     curl_close($ch);   
     ?&gt;
  </code></pre>
  
  <p>I got only Empty response only please give me any idea highly appreciated.</p>