Skip to content
Advertisement

Quickbooks Web Connector “Response is not well-formed XML” error

We are using the Quickbooks Web Connector (QBWC) with the Consolibyte Quickbooks PHP Dev Kit. We have had a QBWC job working with this software for 4 years without major issues; however, now we are adding an additional QBWC job to access a different QB company file and a different handler. Every time this job runs it gets an error “Response is not well-formed XML”:

20211117.18:47:19 UTC   : QBWebConnector.RegistryManager.getUpdateLock() : HKEY_CURRENT_USERSoftwareIntuitQBWebConnectorUpdateLock = FALSE
20211117.18:47:19 UTC   : QBWebConnector.RegistryManager.setUpdateLock() : HKEY_CURRENT_USERSoftwareIntuitQBWebConnectorUpdateLock has been set to True
20211117.18:47:19 UTC   : QBWebConnector.RegistryManager.setUpdateLock() : ********************* Update session locked *********************
20211117.18:47:19 UTC   : QBWebConnector.SOAPWebService.instantiateWebService() : Initiated connection to the following application.
20211117.18:47:19 UTC   : QBWebConnector.SOAPWebService.instantiateWebService() : AppName: SCS Consulting QB Integrator Prod 2
20211117.18:47:19 UTC   : QBWebConnector.SOAPWebService.instantiateWebService() : AppUniqueName (if available): SCS Consulting QB Integrator Prod 2
20211117.18:47:19 UTC   : QBWebConnector.SOAPWebService.instantiateWebService() : AppURL: https://nest.scscertified.com/quickbooks/qbwc_integrator.php?legal_entity=scs_consulting
20211117.18:47:19 UTC   : QBWebConnector.SOAPWebService.do_serverVersion() : *** Calling serverVersion().
20211117.18:47:20 UTC   : QBWebConnector.SOAPWebService.do_serverVersion() : Actual error received from web service for serverVersion call: <Response is not well-formed XML.>. For backward compatibility of all webservers, QBWC will catch all errors under app-not-supporting-serverVersion.
20211117.18:47:20 UTC   : QBWebConnector.SOAPWebService.do_serverVersion() : This application does not contain support for serverVersion. Allowing update operation for backward compatibility.
20211117.18:47:20 UTC   : QBWebConnector.SOAPWebService.do_clientVersion() : *** Calling clientVersion() with following parameter:<productVersion="2.2.0.71">
20211117.18:47:20 UTC   : QBWebConnector.SOAPWebService.updateWS() : Actual error received from web service for clientVersion call: <Response is not well-formed XML.>. For backward compatibility of all webservers, QBWC will catch all errors under app-not-supporting-clientVersion.
20211117.18:47:20 UTC   : QBWebConnector.SOAPWebService.do_clientVersion() : This application does not contain support for clientVersion. Allowing update operation for backward compatibility.
20211117.18:47:20 UTC   : QBWebConnector.SOAPWebService.do_authenticate() : Authenticating to application 'SCS Consulting QB Integrator Prod 2', username = 'scsc_qb'
20211117.18:47:20 UTC   : QBWebConnector.SOAPWebService.do_authenticate() : *** Calling authenticate() with following parameters:<userName="scsc_qb"><password=<MaskedForSecurity>
20211117.18:47:21 UTC   : QBWebConnector.SOAPWebService.do_authenticate() : QBWC1012: Authentication failed due to following error message.
Response is not well-formed XML.

The error starts on serverVersion() but the job doesn’t actually fail until authenticate(). It seems that the problem is in the PHP handler; however, it is not logging any errors, and the dev kit log table shows proper XML:

 | Handler is starting up...: Array
(
    [qb_company_file] => 
    [qbwc_min_version] => 
    [qbwc_wait_before_next_update] => 
    [qbwc_min_run_every_n_seconds] => 
    [qbwc_version_warning_message] => 
    [qbwc_version_error_message] => 
    [qbwc_interactive_url] => 
    [autoadd_missing_requestid] => 1
    [check_valid_requestid] => 1
    [server_version] => PHP QuickBooks SOAP Server v3.0 at /quickbooks/qbwc_integrator.php?legal_entity=scs_consulting
    [authenticate] => 
    [authenticate_dsn] => 
    [map_application_identifiers] => 1
    [allow_remote_addr] => Array
        (
        )

    [deny_remote_addr] => Array
        (
        )

    [convert_unix_newlines] => 1
    [deny_concurrent_logins] => 
    [deny_concurrent_timeout] => 60
    [deny_reallyfast_logins] => 
    [deny_reallyfast_timeout] => 600
    [masking] => 1
)

 | 2021-11-17 10:47:20
|-
 | 697
 | 
 | 0
 | Incoming HTTP Headers: User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; MS Web Services Client Protocol 4.0.30319.42000)
Content-Type: text/xml; charset=utf-8
SOAPAction: "http://developer.intuit.com/serverVersion"
Host: nest.scscertified.com
Content-Length: 300
Expect: 100-continue
Connection: Keep-Alive

 | 2021-11-17 10:47:20
|-
 | 698
 | 
 | 0
 | Incoming SOAP Request: <?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><soap:Body><serverVersion xmlns="http://developer.intuit.com/" /></soap:Body></soap:Envelope>
 | 2021-11-17 10:47:20
|-
 | 699
 | 
 | 0
 | serverVersion()
 | 2021-11-17 10:47:20
|-
 | 700
 | 
 | 0
 | Outgoing SOAP Response: <?xml version="1.0" encoding="UTF-8"?>
            <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" 
             xmlns:ns1="http://developer.intuit.com/">
                <SOAP-ENV:Body><ns1:serverVersionResponse><ns1:serverVersionResult>PHP QuickBooks SOAP Server v3.0 at /quickbooks/qbwc_integrator.php?legal_entity=scs_consulting</ns1:serverVersionResult></ns1:serverVersionResponse>
            </SOAP-ENV:Body>
            </SOAP-ENV:Envelope>

What I don’t understand is that the PHP handler’s XML response to serverVersion() looks fine (in fact identical to the XML returned by the working handler except for the URL), and this handler is logging no errors, but QBWC is rejecting it.

Advertisement

Answer

SOLVED – The XML response to QBWC had a single extra line feed before the XML declaration, which was causing QBWC to completely reject it. The source of the extra character was a PHP config file that had a blank line before the first <?php tag. Doh!

User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement