title: SOAP Request in PHP
body: <p>Good morning everybody,</p>
  
  <p>I searched this website for a helpful response for integrating a SOAP Request in PHP, but I didn't find anything that solved my problem.</p>
  
  <p>I'm new to SOAP and can't figure out why I receive following error message as response:</p>
  
  <p>object(stdClass)#3 (1) { ["CU_Check_BalanceResult"]=> object(stdClass)#4 (1) { ["error"]=> string(20) "Wrong Authentication" } }</p>
  
  <p>This is my PHP Script:</p>
  
  <pre><code>&lt;?php
  
  /* Initialize webservice with your WSDL */
  $client = new SoapClient("https://loyalty.brain-behind.com/CU_WebAPI.asmx?wsdl");
  
  class CU_Check_Balance{
      public $provider,
      $password,
      $CardID,
      $TerminalID;
      }
  
  $parameters = new CU_Check_Balance();
  $parameters-&gt;provider = "string";
  $parameters-&gt;password = "string";
  $parameters-&gt;CardID = "string";
  $parameters-&gt;TerminalID = "string";
  
  $response = $client-&gt;CU_Check_Balance($parameters);
  
  var_dump($response);
  
  ?&gt;
  </code></pre>
  
  <p>The corresponding WSDL can be found here:</p>
  
  <p><a href="http://loyalty.brain-behind.com/CU_WebAPI.asmx?wsdl" rel="nofollow">http://loyalty.brain-behind.com/CU_WebAPI.asmx?wsdl</a></p>
  
  <p>I also tried to implement it in JS, but that didn't work either.</p>
  
  <p>I also installed SOAP UI, made a test project with this wsdl and it worked fine.</p>
  
  <p>This is the example request I got with SOAP UI:</p>
  
  <pre><code>&lt;soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:loy="https://loyalty.brain-behind.com"&gt;
     &lt;soapenv:Header&gt;
        &lt;loy:AuthSoapHd3&gt;
           &lt;!--Optional:--&gt;
           &lt;!--type: string--&gt;
  
           &lt;!--Optional:--&gt;
           &lt;!--type: string--&gt;
           &lt;loy:provider&gt;string&lt;/loy:provider&gt;&lt;loy:password&gt;string&lt;/loy:password&gt;
        &lt;/loy:AuthSoapHd3&gt;
     &lt;/soapenv:Header&gt;
     &lt;soapenv:Body&gt;
        &lt;loy:CU_Check_Balance&gt;
           &lt;!--Optional:--&gt;
           &lt;!--type: string--&gt;
  
           &lt;!--Optional:--&gt;
           &lt;!--type: string--&gt;
           &lt;loy:CardID&gt;string&lt;/loy:CardID&gt;&lt;loy:TerminalID&gt;string&lt;/loy:TerminalID&gt;
        &lt;/loy:CU_Check_Balance&gt;
     &lt;/soapenv:Body&gt;
  &lt;/soapenv:Envelope&gt;
  </code></pre>
  
  <p>Please could somebody help me to get this thing working in php.</p>