title: PHP SOAP client help!
body: <p>I have to create a PHP SOAP client that sends leads, but I have never worked with SOAP before, and my XML isn't that great, here is the code I have managed to write so far. . .</p>
  
  <pre><code>&lt;?php
  
      try {
  
          $client = new SoapClient(null, array(
          'location'  =&gt;  "https://wwa.website.co.za/CallmasterTes/LeadService.asmx",
          'uri'       =&gt;  "urn:Website:Callmaster:InTuch/CreateLead",
          'login'     =&gt;  "username",
          'password'  =&gt;  "password"
          ));
  
              $sysName = ' ';
              $clientCode = ' ';
              $expTimestamp = ' ';
              $schedTimestamp = ' ';
  
          $client-&gt;CreateLead("ExternalLead",
                          new SoapParam($sysName, "BusinessSystemName"),
                          new SoapParam($clientCode, "BusinessSystemClientCode"),
                          new SoapParam($_POST['Title'], "Title"),
                          new SoapParam($_POST['FirstName'], "FirstName"),
                          new SoapParam($_POST['Surname'], "Surname"),
                          new SoapParam($_POST['IdNumber'], "IdNumber"),
                          new SoapParam($_POST['Gender'], "Gender"),
                          new SoapParam($_POST['DateOfBirth'], "DateOfBirth"),
                          new SoapParam($_POST['Language'], "Language"),
                          new SoapParam($_POST['EmailAddress'], "EmailAddress"),
                          new SoapParam($_POST['HomeTelNumber'], "HomeTelNumber"),
                          new SoapParam($_POST['BusinessTelNumber'], "BusinessTelNumber"),
                          new SoapParam($_POST['MobileTelNumber'], "MobileTelNumber"),
                          new SoapParam($_POST['OtherTelNumber'], "OtherTelNumber"),
                          new SoapParam($_POST['PreferredTelNumberCode'], "PreferredTelNumberCode"),
                          new SoapParam($_POST['CampaignName'], "CampaignName"),
                          new SoapParam($_POST['ProductName'], "ProductName"),
                          new SoapParam($_POST['Comments'], "Comments"),
                                              new SoapParam($expTimestamp, "ExpiryTimestamp"),
                                              new SoapParam($schedTimestamp, "ScheduledTimestamp"),
                          );
  
      }
  
      catch (SoapFault $fault) {
          trigger_error("SOAP Fault: (faultcode: {$fault-&gt;faultcode}, faultstring: {$fault-&gt;faultstring})", E_USER_ERROR);
      }
  
  ?&gt;
  </code></pre>
  
  <p>The following is a sample SOAP 1.2 request and response that I was given by the developers on the server side of things.</p>
  
  <pre><code>POST /CallmasterTest/LeadService.asmx HTTP/1.1
  Host: wwa.website.co.za
  Content-Type: application/soap+xml; charset=utf-8
  Content-Length: length
  
  &lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope"&gt;
    &lt;soap12:Body&gt;
      &lt;CreateLead xmlns="urn:Website:Callmaster:InTuch"&gt;
        &lt;Lead&gt;
          &lt;BusinessSystemName&gt;string&lt;/BusinessSystemName&gt;
          &lt;BusinessSystemClientCode&gt;int&lt;/BusinessSystemClientCode&gt;
          &lt;Title&gt;Mr or Ms or Mrs or Miss...etc&lt;/Title&gt;
          &lt;FirstName&gt;string&lt;/FirstName&gt;
          &lt;Surname&gt;string&lt;/Surname&gt;
          &lt;IdNumber&gt;string&lt;/IdNumber&gt;
          &lt;Gender&gt;Male or Female&lt;/Gender&gt;
          &lt;DateOfBirth&gt;date&lt;/DateOfBirth&gt;
          &lt;Language&gt;string&lt;/Language&gt;
          &lt;EmailAddress&gt;string&lt;/EmailAddress&gt;
          &lt;HomeTelNumber&gt;string&lt;/HomeTelNumber&gt;
          &lt;BusinessTelNumber&gt;string&lt;/BusinessTelNumber&gt;
          &lt;MobileTelNumber&gt;string&lt;/MobileTelNumber&gt;
          &lt;OtherTelNumber&gt;string&lt;/OtherTelNumber&gt;
          &lt;PreferredTelNumberCode&gt;Business or Home or Mobile or Other&lt;/PreferredTelNumberCode&gt;
          &lt;CampaignName&gt;string&lt;/CampaignName&gt;
          &lt;ProductName&gt;string&lt;/ProductName&gt;
          &lt;Comments&gt;string&lt;/Comments&gt;
          &lt;ExpiryTimestamp&gt;dateTime&lt;/ExpiryTimestamp&gt;
          &lt;ScheduledTimestamp&gt;dateTime&lt;/ScheduledTimestamp&gt;
        &lt;/Lead&gt;
      &lt;/CreateLead&gt;
    &lt;/soap12:Body&gt;
  &lt;/soap12:Envelope&gt;
  </code></pre>
  
  <p>The response:</p>
  
  <pre><code>HTTP/1.1 200 OK
  Content-Type: application/soap+xml; charset=utf-8
  Content-Length: length
  
  &lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope"&gt;
    &lt;soap12:Body&gt;
      &lt;CreateLeadResponse xmlns="urn:Website:Callmaster:InTuch"&gt;
        &lt;CreateLeadResult&gt;
          &lt;Success&gt;boolean&lt;/Success&gt;
          &lt;StatusMessage&gt;string&lt;/StatusMessage&gt;
          &lt;LeadGuid&gt;guid&lt;/LeadGuid&gt;
          &lt;Errors&gt;
            &lt;LeadError ErrorLevel="Information or Warning or Error"&gt;
              &lt;Message&gt;string&lt;/Message&gt;
              &lt;Field&gt;string&lt;/Field&gt;
            &lt;/LeadError&gt;
            &lt;LeadError ErrorLevel="Information or Warning or Error"&gt;
              &lt;Message&gt;string&lt;/Message&gt;
              &lt;Field&gt;string&lt;/Field&gt;
            &lt;/LeadError&gt;
          &lt;/Errors&gt;
        &lt;/CreateLeadResult&gt;
      &lt;/CreateLeadResponse&gt;
    &lt;/soap12:Body&gt;
  &lt;/soap12:Envelope&gt;
  </code></pre>
  
  <p>I have really tried everything, and googled into high heaven, but I just can't get it to work, I am sure that it's probably something small that I am missing, I would really appreciate the help, thanx!</p>