title: POST SOAP Web-Services with PHP cURL (moving from SOAPUI)
body: <p>I am totally stuck in SOAP integration. I have searched and continously searching for ways how to make it right. My system needs to connect to a certain web service. the URL redirects me to a ?wsdl page.
  I am using SOAPUI to submit request, it is giving me the correct response. I also used SOAPClient but to no avail. I think this is no longer commonly used to this day. I can't find what my error is. Anyone can enlighten me with this? Thank you in advanced. </p>
  
  <p>The SOAPUI request looks like this. It gives me the correct reponse:</p>
  
  <pre><code>POST https://example.com/blah/blah/Upload_v1_Port  HTTP/1.1
      Accept-Encoding: gzip,deflate
      Content-Type: application/soap+xml;charset=UTF-8;action="upload_v1_Binder_ping"
      Content-Length: 205
      Host: bm-webservices-test.example.com.au
      Connection: Keep-Alive
      User-Agent: Apache-HttpClient/4.1.1 (java 1.5)
      Cookie: TS01128e1b=01c05e74c88cb127b6ba1e3cd907936f06957fdeead8e6f308ed6281d48b5da0dbb51b6ca0
      Cookie2: $Version=1
      Authorization: Basic &lt;username:password&gt;
  
  &lt;soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:dir="http://test.com/mrb/ws/upload"&gt;
     &lt;soap:Header/&gt;
     &lt;soap:Body&gt;
        &lt;dir:ping/&gt;
     &lt;/soap:Body&gt;
  &lt;/soap:Envelope&gt;
  </code></pre>
  
  <p>and this is my PHP Written code:</p>
  
  <pre><code>$credentials = "username:password";
  
  $headers = array(
      "POST https://example.com/blah/blah/Upload_v1_Port HTTP/1.1",
      "Accept-Encoding: gzip,deflate",
      "Content-Type: application/soap+xml;charset=UTF-8;action=upload_v1_Binder_ping",
      "Content-Length: 205",
      "Host: bfs-ws-test.test.com.au",
      "Connection: Keep-Alive",
      "User-Agent: Apache-HttpClient/4.1.1 (java 1.5)",
      "Cookie: TS01128e1b=01c05e74c88cb127b6ba1e3cd907936f06957fdeead8e6f308ed6281d48b5da0dbb51b6ca0",
      "Cookie2: $Version=1",
      "Authorization: Basic $credentials",
  );
  
  
  $ch = curl_init();
  curl_setopt($ch, CURLOPT_URL,'http://www.test.com/upload');
  curl_setopt($ch, CURLOPT_CERTINFO, CACERT);
  curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
  curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
  curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 10);
  curl_setopt($ch, CURLOPT_TIMEOUT,        10);
  curl_setopt($ch, CURLOPT_POST, 1);
  curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
  curl_setopt($ch, CURLOPT_POSTFIELDS,     $request_file);
  
  
  $data = curl_exec($ch);
  //pre_print_r($data); exit();
  pre_print_r(curl_getinfo($ch));
  
  if (curl_errno($ch)) {
      print "Error: " . curl_error($ch);
  } else {
      echo 'test';
      pre_print_r($data);
      curl_close($ch);
  }
  </code></pre>
  
  <p>And this is the result that I am getting:</p>
  
  <pre><code>&lt;/pre&gt;&lt;hr&gt;test&lt;pre&gt;--MIMEBoundary_ceea4229e38f12b7cd400440c7bdc1c1fe376164e3efa031
  Content-Type: application/xop+xml; charset=UTF-8; type="text/xml"
  Content-Transfer-Encoding: binary
  Content-ID: &lt;0.deea4229e38f12b7cd400440c7bdc1c1fe376164e3efa031@apache.org&gt;
  
  &lt;faultstring&gt;[ISS.0088.9171] Operation not found for soapAction = null&lt;/faultstring&gt;
  </code></pre>