title: Sending commands to Navision SOAP Service
body: <p>I try to send commands to a Navision web service. To understand the whole connection as best as I can, I want to use at first simple cURL commands.</p>
  
  <p>I experiemented with simple GET Requests on the URL <code>https://IP:PORT/.../Codeunit/Webservices</code>. There I got a very long XML structure with all the commands. Part of the list is a simple echo command where I can send a string and get it back.</p>
  
  <p>This is the discription of it:</p>
  
  <pre><code>&lt;schema elementFormDefault="qualified" targetNamespace="urn:microsoft-dynamics-schemas/codeunit/Webservices" xmlns="http://www.w3.org/2001/XMLSchema"&gt;
    &lt;element name="SoundCheck"&gt;
      &lt;complexType&gt;
        &lt;sequence&gt;
          &lt;element minOccurs="1" maxOccurs="1" name="p_Text" type="string"/&gt;
        &lt;/sequence&gt;
      &lt;/complexType&gt;
    &lt;/element&gt;
    &lt;element name="SoundCheck_Result"&gt;
      &lt;complexType&gt;
        &lt;sequence&gt;
          &lt;element minOccurs="1" maxOccurs="1" name="return_value" type="string"/&gt;
        &lt;/sequence&gt;
      &lt;/complexType&gt;
    &lt;/element&gt;
  ...
  </code></pre>
  
  <p>Now my problem is that I don't know how to send the command. I looked in these two special SOAP libraries:</p>
  
  <ul>
  <li><a href="https://github.com/jamesiarmes/php-ntlm" rel="nofollow noreferrer">https://github.com/jamesiarmes/php-ntlm</a></li>
  <li><a href="https://github.com/rileydutton/Exchange-Web-Services-for-PHP" rel="nofollow noreferrer">https://github.com/rileydutton/Exchange-Web-Services-for-PHP</a></li>
  </ul>
  
  <p>I tried their approches but nothing works. My code snippet now looks like this:</p>
  
  <pre><code>$headers = [
      'Method: GET',
      'Connection: Keep-Alive',
      'User-Agent: PHP-SOAP-CURL',
      'Content-Type: text/xml; charset=utf-8',
      'SOAPAction: "' . $action . '"',
  ];
  
  $ch = curl_init($url);
  
  curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
  curl_setopt($ch, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1);
  curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
  curl_setopt($ch, CURLOPT_USERPWD, $username . ':' . $password);
  curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
  curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
  
  $response = curl_exec($ch);
  
  return $response;
  </code></pre>
  
  <p>I tried to send various values of <code>$action</code> but I always get this error:</p>
  
  <pre><code>&lt;s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"&gt;&lt;s:Body&gt;&lt;s:Fault&gt;
      &lt;faultcode xmlns:a="urn:microsoft-dynamics-schemas/error"&gt;a:System.ArgumentNullParametername: input&lt;/faultstring&gt;
      &lt;detail&gt;&lt;string xmlns="http://schemas.microsoft.com/2003/10/Serialization/"&gt;Der Wert darf nicht NULL sein.\nParametername: input&lt;/string&gt;&lt;/detail&gt;
  &lt;/s:Fault&gt;&lt;/s:Body&gt;&lt;/s:Envelope&gt;
  </code></pre>
  
  <p>Maybe I misunderstood the whole SOAP process with navision, but I also don't found any really good tutorials in the web. What am I doing wrong? Thanks for help!</p>