title: QBWC1012: Authentication failed due to following error message. Index was outside the bounds of the array
body: <p>I am integrating QuickBooks Desktop Enterprise 2013 with a web app using the Web Connector version 2.1.0.30 as an intermediary.
  The SOAP service I developed with WCF in Visual Studio Core, and the Web Connector accesses without problems to my services, here I show the execution log of the web connector</p>
  
  <blockquote>
    <p>Blockquote
    20170811.21:39:26 UTC   : QBWebConnector.WebServiceManager.DoUpdateSelected() : updateWS() for application = 'WCService' has STARTED
    20170811.21:39:26 UTC   : QBWebConnector.RegistryManager.getUpdateLock() : HKEY_CURRENT_USER\Software\Intuit\QBWebConnector\UpdateLock = FALSE
    20170811.21:39:26 UTC   : QBWebConnector.RegistryManager.setUpdateLock() : HKEY_CURRENT_USER\Software\Intuit\QBWebConnector\UpdateLock has been set to True
    20170811.21:39:26 UTC   : QBWebConnector.RegistryManager.setUpdateLock() : ********************* Update session locked *********************
    20170811.21:39:26 UTC   : QBWebConnector.SOAPWebService.instantiateWebService() : Initiated connection to the following application.
    20170811.21:39:26 UTC   : QBWebConnector.SOAPWebService.instantiateWebService() : AppName: WCService
    20170811.21:39:26 UTC   : QBWebConnector.SOAPWebService.instantiateWebService() : AppUniqueName (if available): WCService
    20170811.21:39:26 UTC   : QBWebConnector.SOAPWebService.instantiateWebService() : AppURL: <a href="http://localhost:14319/WCService.svc" rel="nofollow noreferrer">http://localhost:14319/WCService.svc</a>
    20170811.21:39:26 UTC   : QBWebConnector.SOAPWebService.do_serverVersion() :  Calling serverVersion().
    20170811.21:39:26 UTC   : QBWebConnector.SOAPWebService.do_serverVersion() : Received from serverVersion() following parameter:
    20170811.21:39:26 UTC   : QBWebConnector.SOAPWebService.do_clientVersion() :  Calling clientVersion() with following parameter:
    20170811.21:39:26 UTC   : QBWebConnector.SOAPWebService.do_clientVersion() : Received from clientVersion() following parameter:
    20170811.21:39:26 UTC   : QBWebConnector.SOAPWebService.do_clientVersion() : This application agrees with the current version of QBWebConnector. Allowing update operation.
    20170811.21:39:26 UTC   : QBWebConnector.SOAPWebService.do_authenticate() : Authenticating to application 'WCService', username = 'Dalo'
    20170811.21:39:26 UTC   : QBWebConnector.SOAPWebService.do_authenticate() : <strong>* Calling authenticate() with following parameters:
    **20170811.21:39:28 UTC : QBWebConnector.SOAPWebService.do_authenticate() : QBWC1012: Authentication failed due to following error message.
    Índice fuera de los límites de la matriz.</strong>
    More info:
    StackTrace =    en QBWebConnector.WebService.do_authenticate(String&amp; ticket, String&amp; companyFileName)
    Source = QBWebConnector
    20170811.21:39:28 UTC   : QBWebConnector.RegistryManager.setUpdateLock() : HKEY_CURRENT_USER\Software\Intuit\QBWebConnector\UpdateLock has been set to False
    20170811.21:39:28 UTC   : QBWebConnector.RegistryManager.setUpdateLock() : ********************* Update session unlocked *********************
    20170811.21:39:28 UTC   : QBWebConnector.WebServiceManager.DoUpdateSelected() : Update completed with errors. See log (QWClog.txt) for details.
    Blockquote</p>
  </blockquote>
  
  <p>Now I show you my QWC file</p>
  
  <pre class="lang-xml prettyprint-override"><code>&lt;?xml version="1.0"?&gt;
  &lt;QBWCXML&gt;
    &lt;AppDescription&gt;QB Web Service&lt;/AppDescription&gt;
    &lt;AppID&gt;&lt;/AppID&gt;
    &lt;AppName&gt;WCService&lt;/AppName&gt;
    &lt;AppSupport&gt;http://localhost:14319/WCService.svc?wsdl&lt;/AppSupport&gt;
    &lt;AppURL&gt;http://localhost:14319/WCService.svc&lt;/AppURL&gt;
    &lt;FileID&gt;{CA1C3EB8-1B61-4747-A743-8D5B438B83AC}&lt;/FileID&gt;
    &lt;OwnerID&gt;{8C809D2B-69A9-4B43-A9D0-D41C0938368B}&lt;/OwnerID&gt;  
    &lt;QBType&gt;QBFS&lt;/QBType&gt;
    &lt;Style&gt;Document&lt;/Style&gt;
    &lt;UserName&gt;Dalo&lt;/UserName&gt;
  &lt;/QBWCXML&gt;
  </code></pre>
  
  <p>Then the service code:</p>
  
  <pre><code>public string[] authenticate(string strUserName, string strPassword)
      {
          string evLogTxt = "WebMethod: authenticate() has been called by QBWebconnector" + "\r\n\r\n";
          evLogTxt = evLogTxt + "Parameters received:\r\n";
          evLogTxt = evLogTxt + "string strUserName = " + strUserName + "\r\n";
          evLogTxt = evLogTxt + "string strPassword = " + strPassword + "\r\n";
          evLogTxt = evLogTxt + "\r\n";
  
  
          string[] authReturn = new string[3];
          // Code below uses a random GUID to use as session ticket
          // An example of a GUID is {85B41BEE-5CD9-427a-A61B-83964F1EB426}
          authReturn[0] = System.Guid.NewGuid().ToString();
  
          // For simplicity of sample, a hardcoded username/password is used.
          // In real world, you should handle authentication in using a standard way. 
          // For example, you could validate the username/password against an LDAP 
          // or a directory server
          string pwd = "password";
          evLogTxt = evLogTxt + "Password locally stored = " + pwd + "\r\n";
          if (strUserName.Trim().Equals("Dalo") &amp;&amp; strPassword.Trim().Equals(pwd))
          {
              // An empty string for authReturn[1] means asking QBWebConnector 
              // to connect to the company file that is currently openned in QB
              authReturn[1] = "C:\\Users\\Dalo\\Documents\\company.QBW";                
              authReturn[2] = "10";                
          }
          else
          {
              authReturn[1] = "nvu";
              authReturn[2] = "";                
          }
          // You could also return "none" to indicate there is no work to do
          // or a company filename in the format C:\full\path\to\company.qbw
          // based on your program logic and requirements.
  
          evLogTxt = evLogTxt + "\r\n";
          evLogTxt = evLogTxt + "Return values: " + "\r\n";
          evLogTxt = evLogTxt + "string[] authReturn[0] = " + authReturn[0].ToString() + "\r\n";
          evLogTxt = evLogTxt + "string[] authReturn[1] = " + authReturn[1].ToString();
          logEvent(evLogTxt);
          return authReturn;
      }
  </code></pre>
  
  <p>Other data:</p>
  
  <ol>
  <li><p>The authenticate service was tested with the Visual Studio WCF Test Client tool.</p></li>
  <li><p>In code debugging, when the authentication fails, the web connector calls neither the connectionError service nor the closeConnection to terminate the connection.</p></li>
  <li><p>In debugging the code, you can see that the whole code of the authenticate service is run without throwing any exceptions.</p></li>
  </ol>
  
  <p>This's response </p>
  
  <pre class="lang-xml prettyprint-override"><code>    &lt;s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"&gt;
          &lt;s:Body&gt;
              &lt;authenticateResponse xmlns="http://developer.intuit.com/"&gt;
                  &lt;authenticateResult xmlns:a="http://schemas.microsoft.com/2003/10/Serialization/Arrays" xmlns:i="http://www.w3.org/2001/XMLSchema-instance"&gt;
                      &lt;a:string&gt;bd68a1e2-7780-46ed-bb8a-09b2b25e156f&lt;/a:string&gt;
                      &lt;a:string&gt;C:\Users\Dalo\Documents\company.QBW&lt;/a:string&gt;
                  &lt;/authenticateResult&gt;
              &lt;/authenticateResponse&gt;
          &lt;/s:Body&gt;
      &lt;/s:Envelope&gt;
  </code></pre>