title: Fatal error: Uncaught SoapFault exception: [Client] Error finding "uri" property in
body: <p>The title yields me some SO links but unfortunately I couldn't get them to work. I am totally new to SOAP. I have been given a wsdl link and there are some method I need to call through soap. </p>
  
  <p>I am stuck at a particular point where it says  </p>
  
  <blockquote>
    <p>Uncaught SoapFault exception: [Client] Error finding "uri" property in
    there error is generating at this code.</p>
  </blockquote>
  
  <pre><code>class SoapClientCompatibility extends SoapClient{
      public function __construct($wsdl, $options){
          // do things here, like:
          // download the wsdl using curl
      }}function soapClientWSSecurityHeader($user, $password){
    // Creating date using yyyy-mm-ddThh:mm:ssZ format
    $tm_created = gmdate('Y-m-d\TH:i:s\Z');
    $tm_expires = gmdate('Y-m-d\TH:i:s\Z', gmdate('U') + 180); //only necessary if using the timestamp element
    // Generating and encoding a random number
    $simple_nonce = mt_rand();
    $encoded_nonce = base64_encode($simple_nonce);
    // Compiling WSS string
    $passdigest = base64_encode(sha1($simple_nonce . $tm_created . $password, true));
  
    // Initializing namespaces
    $ns_wsse = 'http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd';
    $ns_wsu = 'http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd';
    $password_type = 'http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordDigest';
  $encoding_type = 'http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary';
  
    // Creating WSS identification header using SimpleXML
    $root = new SimpleXMLElement('&lt;root/&gt;');
  
    $security = $root-&gt;addChild('wsse:Security', null, $ns_wsse);
    //the timestamp element is not required by all servers
    $timestamp = $security-&gt;addChild('wsu:Timestamp', null, $ns_wsu);
    $timestamp-&gt;addAttribute('wsu:Id', 'Timestamp-28');
    $timestamp-&gt;addChild('wsu:Created', $tm_created, $ns_wsu);
    $timestamp-&gt;addChild('wsu:Expires', $tm_expires, $ns_wsu);
  
    $usernameToken = $security-&gt;addChild('wsse:UsernameToken', null, $ns_wsse);
    $usernameToken-&gt;addChild('wsse:Username', $user, $ns_wsse);
    $usernameToken-&gt;addChild('wsse:Password', $passdigest, $ns_wsse)-&gt;addAttribute('Type', $password_type);
    $usernameToken-&gt;addChild('wsse:Nonce', $encoded_nonce, $ns_wsse)-&gt;addAttribute('EncodingType', $encoding_type);
    $usernameToken-&gt;addChild('wsu:Created', $tm_created, $ns_wsu);
  
  
  
    // Recovering XML value from that object
    $root-&gt;registerXPathNamespace('wsse', $ns_wsse);
    $full = $root-&gt;xpath('/root/wsse:Security');
    $auth = $full[0]-&gt;asXML();
    print_r($auth);
    return new SoapHeader($ns_wsse, 'Security', new SoapVar($auth, XSD_ANYXML), true,'https://mywebsite.com');
  }
  class Valid {
      function Valid($hn, $vc) 
      {
          $this-&gt;healthNumber = $healthNumber;
          $this-&gt;versionCode = $versionCode;
      }
  }
  $hcvRequest = array(
      "healthNumber" =&gt; "1286844022",
      "versionCode" =&gt; "YX"
  );
  $valid = array(
      "hcvRequest" =&gt; $hcvRequest
  );
  
  $params = array(
      "requests" =&gt; $valid
  );
  
  $client = new SoapClientCompatibility('https://example.com/?wsdl');$client-&gt;__setSoapHeaders(soapClientWSSecurityHeader('someemail@email.com', 'somepassword'));
  echo "&lt;pre&gt;";
  $response = $client-&gt;__soapCall("validate", array($params));
  print_r($client);
  print_r($response);
  </code></pre>