title: How do you make a SoapCall using the PHP Soap class client
body: <p>I am attempting to make a SOAP call in PHP using the PHP Soap Client class. I managed to connect to the WDSL file however it isn't accepting my parameters. Here are all the necessary information needed for this call. When I enter the following:</p>
  
  <pre><code>    $wsdlUrl = 'https://irm.cooperboating.com/rdpwincentralsvc/irmpublic.asmx?WSDL';
      $client = new SoapClient($wsdlUrl);
      var_dump($client-&gt;__getFunctions());
      var_dump($client-&gt;__getTypes());
  </code></pre>
  
  <p>I get:</p>
  
  <pre><code>  // Output from getFunctions()
    [26]=&gt;
    string(83) "GetCourseInformationResponse GetCourseInformation(GetCourseInformation $parameters)"
  
    // Output from getTypes()
    [117]=&gt;
    string(63) "struct GetCourseInformation {
       GetCourseInformation_irmRQ RQ;
    }"
    [118]=&gt;
    string(152) "struct GetCourseInformation_irmRQ {
       irmWebSvcCredentials Credentials;
       string CourseNumber;
       string CourseID;
       dateTime StartDate;
       dateTime EndDate;
    }"
    [4]=&gt;
    string(104) "struct irmWebSvcCredentials {
       string LogonID;
       string Password;
       string DataPath;
       string DatabaseID;
    }"
  </code></pre>
  
  <p>After reading the answer from: <a href="https://stackoverflow.com/questions/11593623/how-to-make-a-php-soap-call-using-the-soapclient-class">How to make a PHP SOAP call using the SoapClient class</a>
  I have attempted the following:</p>
  
  <pre><code>
  class irmWebSvcCredentials {
  
      public function __construct() {
          $this-&gt;LogonID = "SomeLogin";
          $this-&gt;Password = "SomPass";
          $this-&gt;DataPath = "SomePath";
          $this-&gt;DatabaseID = "SomeId";
      }
  }
  
  try {
  
      $wsdlUrl = 'https://irm.cooperboating.com/rdpwincentralsvc/irmpublic.asmx?WSDL';
      $client = new SoapClient($wsdlUrl);
      $credentials = new irmWebSvcCredentials();
      $params = array(
          "Credentials" =&gt; $credentials,
          "CourseNumber" =&gt; "",
          "CourseID" =&gt; "",
          "StartDate" =&gt; "2019-12-05T18:13:00",
          "EndDate" =&gt; "2025-12-29T18:13:00",
      );
  
      $response = $client-&gt;GetCourseInformation(array($params));
      var_dump($response);
  
  }
  catch(Exception $e) {
      echo $e-&gt;getMessage();
  }
  </code></pre>
  
  <p>I've also tried inputting "Credentials" as just an array instead of a class as some other answers have suggested like so:</p>
  
  <pre><code>    $params = array(
          "Credentials" =&gt; array(
              "LogonID" =&gt; "SomeLogin",
              "Password" =&gt; "SomPass",
              "DataPath" =&gt; "SomePath",
              "DatabaseID" =&gt; "SomeId",
          ),
          "CourseNumber" =&gt; "",
          "CourseID" =&gt; "",
          "StartDate" =&gt; "2019-12-05T18:13:00",
          "EndDate" =&gt; "2025-12-29T18:13:00",
      );
  </code></pre>
  
  <p>It doesn't seem to matter what I input for the parameters when I call $client->GetCourseInformation, as long as I provide a parameter in the structure of an array it always gives me the same output which is:</p>
  
  <pre><code>object(stdClass)#3 (1) {
    ["GetCourseInformationResult"]=&gt;
    object(stdClass)#4 (3) {
      ["Status"]=&gt;
      int(1)
      ["ErrMsg"]=&gt;
      string(47) "GetCourseInformation_irmRQ is not instantiated."
  ...
  </code></pre>
  
  <p>Using Postman I've been able to get the expected output so that leads me to believe that I am not providing a certain parameter. Lastly here is the body I provide in Postman to get the expected output with content type being text/xml:</p>
  
  <pre><code>&lt;soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"&gt;
    &lt;soap:Body&gt;
      &lt;GetCourseInformation xmlns="http://someurl.com/irmpublic"&gt;
        &lt;RQ&gt;
          &lt;Credentials&gt;
           &lt;LogonID&gt;SomeLogin&lt;/LogonID&gt;
           &lt;Password&gt;SomPass&lt;/Password&gt;
           &lt;DataPath&gt;SomePath&lt;/DataPath&gt;
           &lt;DatabaseID&gt;SomeId&lt;/DatabaseID&gt;
         &lt;/Credentials&gt;
          &lt;CourseNumber&gt;&lt;/CourseNumber&gt;
          &lt;CourseID&gt;&lt;/CourseID&gt;
          &lt;StartDate&gt;2019-12-20T18:13:00&lt;/StartDate&gt;
          &lt;EndDate&gt;2025-12-29T18:13:00&lt;/EndDate&gt;
        &lt;/RQ&gt;
      &lt;/GetCourseInformation&gt;
    &lt;/soap:Body&gt;
  &lt;/soap:Envelope&gt;
  </code></pre>
  
  <p>Is there something I'm not providing? Or does this problem have something to do with the API itself?</p>