Jeffiec_c
Jeffiec_c

Reputation: 55

QBWC Logfile and server logs not matching, cannot connect application to QBWC

Trying to add an application to QBWC and the server logs show a successful connection:

 2024-07-24 12:18:32 serverVersion called
 2024-07-24 12:18:32 clientVersion called with version: 34.0.1001.27
 2024-07-24 12:18:32 authenticate called with username: Admin, password: 0Jltest1
 2024-07-24 12:18:32 Authentication successful, ticket: 66a0f118a2ff0

However QBWC fails with this error:

 20240724.12:21:56 UTC  : QBWebConnector.SOAPWebService.do_authenticate() : QBWC1012: 
 Authentication failed due to following error message.
 Object reference not set to an instance of an object.
 More info:
 StackTrace =    at QBWebConnector.WebService.do_authenticate(String& ticket, String& companyFileName)

here is the full QBWC logfile:

 20240724.12:21:55 UTC  : QBWebConnector.WebServiceManager.DoUpdateSelected() : 
 updateWS() for application = 'OJL QuickBooks Integrator Main' has STARTED
 20240724.12:21:55 UTC  : QBWebConnector.RegistryManager.getUpdateLock() : HKEY_CURRENT_USER\Software\Intuit\QBWebConnector\UpdateLock = FALSE
 20240724.12:21:55 UTC  : QBWebConnector.RegistryManager.setUpdateLock() : HKEY_CURRENT_USER\Software\Intuit\QBWebConnector\UpdateLock has been set to True
 20240724.12:21:55 UTC  : QBWebConnector.RegistryManager.setUpdateLock() : ********************* Update session locked *********************
 20240724.12:21:55 UTC  : QBWebConnector.SOAPWebService.instantiateWebService() : Initiated connection to the following application.
 20240724.12:21:55 UTC  : QBWebConnector.SOAPWebService.instantiateWebService() : AppName: OJL QuickBooks Integrator Main
 20240724.12:21:55 UTC  : QBWebConnector.SOAPWebService.instantiateWebService() : AppUniqueName (if available): OJL QuickBooks Integrator Main
 20240724.12:21:55 UTC  : QBWebConnector.SOAPWebService.instantiateWebService() : AppURL: https://ojlforklifts.com/wp-content/themes/responsive-mobile-child/inc/qb/qbwc_handler.php
 20240724.12:21:55 UTC  : QBWebConnector.SOAPWebService.do_serverVersion() : *** Calling serverVersion().
 20240724.12:21:55 UTC  : QBWebConnector.SOAPWebService.do_serverVersion() : Received from serverVersion() following parameter:<serverVersionRet="">
 20240724.12:21:55 UTC  : QBWebConnector.SOAPWebService.do_serverVersion() : This application sent a null for server version. Allowing update operation.
 20240724.12:21:55 UTC  : QBWebConnector.SOAPWebService.do_clientVersion() : *** Calling clientVersion() with following parameter:<productVersion="34.0.1001.27">
 20240724.12:21:56 UTC  : QBWebConnector.SOAPWebService.do_clientVersion() : Received from clientVersion() following parameter:<clientVersionRet="">
 20240724.12:21:56 UTC  : QBWebConnector.SOAPWebService.do_clientVersion() : This application agrees with the current version of QBWebConnector. Allowing update operation.
 20240724.12:21:56 UTC  : QBWebConnector.SOAPWebService.do_authenticate() : Authenticating to application 'OJL QuickBooks Integrator Main', username = 'Admin'
 20240724.12:21:56 UTC  : QBWebConnector.SOAPWebService.do_authenticate() : *** Calling authenticate() with following parameters:<userName="Admin"><password=<MaskedForSecurity>
 20240724.12:21:56 UTC  : QBWebConnector.SOAPWebService.do_authenticate() : QBWC1012: 
  Authentication failed due to following error message.
  Object reference not set to an instance of an object.
  More info:
  StackTrace =    at QBWebConnector.WebService.do_authenticate(String& ticket, String& companyFileName)
  Source = QBWebConnector
  20240724.12:21:56 UTC : QBWebConnector.RegistryManager.setUpdateLock() : HKEY_CURRENT_USER\Software\Intuit\QBWebConnector\UpdateLock has been set to False
  20240724.12:21:56 UTC : QBWebConnector.RegistryManager.setUpdateLock() : ********************* Update session unlocked *********************
  20240724.12:21:56 UTC : QBWebConnector.WebServiceManager.DoUpdateSelected() : Update completed with errors. See log (QWClog.txt) for details.

here is my QWC file ojlmain.qwc:

<?xml version="1.0"?>
<QBWCXML>
<AppName>OJL QuickBooks Integrator Main</AppName>
<AppID>OJL Main App</AppID>
<AppURL>https://mydomain//inc/qb/qbwc_handler.php</AppURL>
<AppDescription>OJL Quickbooks</AppDescription>
<AppSupport>https://mydomain/inc/qb/support.php</AppSupport>
<UserName>Admin</UserName>
<OwnerID>{6a342688-24f0-4435-b3f7-b1597948b0f7}</OwnerID>
<FileID>{57F3B9B6-86F1-4FCC-B1FF-684DE28867R6}</FileID>
<CertURL>https://ojlforklifts.com/</CertURL>
<QBType>QBFS</QBType>
<Style>Document</Style>
<IsReadOnly>false</IsReadOnly>
</QBWCXML>

Here is my handler code

<?php
 class QuickBooksHandler
 {
private $username = 'Admin';
private $password = '0JlFork#1';
private $logFile;

public function __construct() {
    // Create a log file if it doesn't exist and set permissions
    $this->logFile = __DIR__ . '/qbwc.log';
    if (!file_exists($this->logFile)) {
        file_put_contents($this->logFile, '');
        chmod($this->logFile, 0666);
    }
}

private function log($message) {
    file_put_contents($this->logFile, date('Y-m-d H:i:s') . ' ' . $message . PHP_EOL, FILE_APPEND);
}

public function authenticate($username, $password)
{
    $this->log("authenticate called with username: $username, password: $password");

    if ($username == $this->username && $password == $this->password) {
        $ticket = uniqid();
        $this->log("Authentication successful, ticket: $ticket");
        return [
            'authenticateResult' => [
                'string' => [$ticket, '', '', '']
            ]
        ];
        
    } else {
        $this->log("Authentication failed");
        return [
            'authenticateResult' => [
                'string' => ['nvu']
            ]
        ];
    }
}

public function sendRequestXML($ticket, $strHCPResponse, $strCompanyFileName, $qbXMLCountry, $qbXMLMajorVers, $qbXMLMinorVers)
{
    $this->log("sendRequestXML called with ticket: $ticket, company file: $strCompanyFileName");

    $qbxml = '<QBXML>
                  <QBXMLMsgsRq onError="stopOnError">
                       
                  </QBXMLMsgsRq>
              </QBXML>';
    $this->log("Request XML: $qbxml");
    return ['string' => $qbxml];
}

public function receiveResponseXML($ticket, $response, $hresult, $message)
{
    $this->log("receiveResponseXML called with ticket: $ticket, response: $response, hresult: $hresult, message: $message");

    return ['int' => 100]; // 100% done
}

public function serverVersion()
{
    $this->log("serverVersion called");
    return ['string' => '1.0'];
}

public function clientVersion($strVersion)
{
    $this->log("clientVersion called with version: $strVersion");
    return ['string' => '']; // return empty string if client version is supported
}

public function closeConnection($ticket)
{
    $this->log("closeConnection called with ticket: $ticket");
    return ['string' => 'Connection closed'];
}

public function __call($method, $args)
{
    $this->log("Method $method not found");
    return new SoapFault("Server", "Method not found");
}
}
$options = [
'uri' => 'https://mydomain/inc/qb/qbwc.wsdl',
'encoding' => 'UTF-8'
];
$server = new SoapServer(null, $options);
$server->setClass('QuickBooksHandler');
$server->handle();

No matter what changes i make, the server logfile will always show successful along with a ticket number, but QBWC always shows the same error.

I have searched for a few days on this even asked the question on Intuit Developer site, no answers and i cant find a specific article about my particular problem, i have tried several changes, verbose logging registry changes and server changes, to no avail.

Any help would be appreciated, thanks in advance.

Upvotes: 0

Views: 66

Answers (0)

Related Questions