我一直在尝试创建一个简单的 Web 服务,该服务能够在 Windows 7 上使用 Quickbooks 2012 连接到 Quickbooks Web 连接器。
编程指南( http://developer.intuit.com/qbsdk-current/doc/pdf/qbwc_proguide.pdf )中清楚地描述了实现。
在验证方法中,我不断收到与“身份验证失败”和“对象引用未设置为对象实例”相同的错误。我首先使用 Eclipse 在 java 中创建了示例 Web 服务。
问题出在身份验证方法中。
我还为 Web 连接器打开了 VERBOSE 模式。
以下是完整日志
20120924.15:11:25 UTC : QBWebConnector.SOAPWebService.ConnectToQB() : Connecting to QuickBooks...
20120924.15:11:25 UTC : QBWebConnector.SOAPWebService.ConnectToQB() : Connected., Session started
20120924.15:11:25 UTC : QBWebConnector.SOAPWebService.deleteFileIDValueFromQB() : Deleting FileID value from Company object for the ownerID = {57F3B9B1-86F1-4fcc-B1EE-566DE1813D10}
20120924.15:11:25 UTC : QBWebConnector.SOAPWebService.deleteFileIDValueFromQB() : XML dump follows: -
<?xml version="1.0"?><?qbxml version="11.0"?><QBXML><QBXMLMsgsRq onError="stopOnError"><DataExtDelRq requestID="1"><DataExtDel><OwnerID>{57F3B9B1-86F1-4fcc-B1EE-566DE1813D10}</OwnerID><DataExtName>FileID</DataExtName><OtherDataExtType>Company</OtherDataExtType></DataExtDel></DataExtDelRq></QBXMLMsgsRq></QBXML>
20120924.15:11:25 UTC : QBWebConnector.SOAPWebService.registerDataExtInQB() : XML dump follows: -
<?xml version="1.0" ?>
<QBXML>
<QBXMLMsgsRs>
<DataExtDelRs requestID="1" statusCode="0" statusSeverity="Info" statusMessage="Status OK">
<DataExtDelRet>
<OwnerID>{57F3B9B1-86F1-4fcc-B1EE-566DE1813D10}</OwnerID>
<DataExtName>FileID</DataExtName>
<TimeDeleted>2012-09-24T20:41:25+05:30</TimeDeleted>
</DataExtDelRet>
</DataExtDelRs>
</QBXMLMsgsRs>
</QBXML>
20120924.15:11:25 UTC : QBWebConnector.SOAPWebService.DisconnectFromQB() : Session ended and connection closed
20120924.15:11:25 UTC : QBWebConnector.SOAPWebService.deleteFileIDValueFromQB() : Data extension FileID has been cleared from QuickBooks for owner id.
20120924.15:11:25 UTC : RemoveApp() : Application PratikWS has been removed.
20120924.15:11:29 UTC : QWCReader.ParseQWC() : Contents of QWC file: -
<QBWCXML>
<AppName>PratikWS</AppName>
<AppID></AppID>
<AppURL>http://localhost:8080/TestWS/services/TestHello?WSDL</AppURL>
<AppDescription>A short description for WCWebService1</AppDescription>
<AppSupport>http://localhost:8080</AppSupport>
<UserName>pratik</UserName>
<OwnerID>{57F3B9B1-86F1-4fcc-B1EE-566DE1813D10}</OwnerID>
<FileID>{90A44FB5-33D9-4815-AC85-BC87A7E7D1FB}</FileID>
<QBType>QBFS</QBType>
<Scheduler>
<RunEveryNMinutes>2</RunEveryNMinutes>
</Scheduler>
</QBWCXML>
20120924.15:11:29 UTC : QBWebConnector.WebServiceManager.ReadQWC(QWCReader QWC) : Parsing application configuration xml file to load its content to variables
20120924.15:11:30 UTC : QBWebConnector.RegistryManager.createRegKey() : Error creating registry key for appName = <>
20120924.15:11:30 UTC : QBWebConnector.RegistryManager.createRegKey() : Reason: Value cannot be null.
Parameter name: name
20120924.15:11:30 UTC : QBWebConnector.SOAPWebService.SerializeToRegistry() : Error saving PratikWS to Registry: Object reference not set to an instance of an object.
20120924.15:11:30 UTC : QBWebConnector.SOAPWebService.ConnectToQB() : Connecting to QuickBooks...
20120924.15:11:31 UTC : QBWebConnector.SOAPWebService.ConnectToQB() : Connected., Session started
20120924.15:11:31 UTC : QBWebConnector.SOAPWebService.AddToQuickBooks() : Application name = PratikWS
20120924.15:11:31 UTC : QBWebConnector.SOAPWebService.AddToQuickBooks() : Querying company file to find if owner/file id exists.
20120924.15:11:31 UTC : QBWebConnector.SOAPWebService.findFileIDinQB() : Latest QBXML version supported = v11.0
20120924.15:11:31 UTC : QBWebConnector.SOAPWebService.findFileIDinQB() : Querying QuickBooks for existance of owner/file id
20120924.15:11:31 UTC : QBWebConnector.SOAPWebService.findFileIDinQB() : XML dump follows: -
<?xml version="1.0"?><?qbxml version="11.0"?><QBXML><QBXMLMsgsRq onError="stopOnError"><DataExtDefQueryRq requestID="1"><OwnerID>{57F3B9B1-86F1-4fcc-B1EE-566DE1813D10}</OwnerID></DataExtDefQueryRq></QBXMLMsgsRq></QBXML>
20120924.15:11:31 UTC : QBWebConnector.SOAPWebService.findFileIDinQB() : XML dump follows: -
<?xml version="1.0" ?>
<QBXML>
<QBXMLMsgsRs>
<DataExtDefQueryRs requestID="1" statusCode="0" statusSeverity="Info" statusMessage="Status OK">
<DataExtDefRet>
<OwnerID>{57F3B9B1-86F1-4FCC-B1EE-566DE1813D10}</OwnerID>
<DataExtName>AppLock</DataExtName>
<DataExtType>STR255TYPE</DataExtType>
<AssignToObject>Company</AssignToObject>
</DataExtDefRet>
<DataExtDefRet>
<OwnerID>{57F3B9B1-86F1-4FCC-B1EE-566DE1813D10}</OwnerID>
<DataExtName>FileID</DataExtName>
<DataExtType>STR255TYPE</DataExtType>
<AssignToObject>Company</AssignToObject>
</DataExtDefRet>
</DataExtDefQueryRs>
</QBXMLMsgsRs>
</QBXML>
20120924.15:11:31 UTC : QBWebConnector.SOAPWebService.findFileIDinQB() : Status message: Status OK
20120924.15:11:31 UTC : QBWebConnector.SOAPWebService.registerDataExtInQB() : Creating DataExtDef named AppLock assigned to Company object for the ownerID = {57F3B9B1-86F1-4fcc-B1EE-566DE1813D10}
20120924.15:11:31 UTC : QBWebConnector.SOAPWebService.registerDataExtInQB() : XML dump follows: -
<?xml version="1.0"?><?qbxml version="11.0"?><QBXML><QBXMLMsgsRq onError="stopOnError"><DataExtDefAddRq requestID="1"><DataExtDefAdd><OwnerID>{57F3B9B1-86F1-4fcc-B1EE-566DE1813D10}</OwnerID><DataExtName>AppLock</DataExtName><DataExtType>STR255TYPE</DataExtType><AssignToObject>Company</AssignToObject></DataExtDefAdd></DataExtDefAddRq></QBXMLMsgsRq></QBXML>
20120924.15:11:31 UTC : QBWebConnector.SOAPWebService.registerDataExtInQB() : XML dump follows: -
<?xml version="1.0" ?>
<QBXML>
<QBXMLMsgsRs>
<DataExtDefAddRs requestID="1" statusCode="3100" statusSeverity="Error" statusMessage="The name "AppLock" of the list element is already in use." />
</QBXMLMsgsRs>
</QBXML>
20120924.15:11:31 UTC : QBWebConnector.SOAPWebService.registerDataExtInQB() : Data extension definition has been created in QuickBooks for owner id.
20120924.15:11:31 UTC : QBWebConnector.SOAPWebService.AddToQuickBooks() : Registered the AppLock to company file successfully.
20120924.15:11:31 UTC : QBWebConnector.SOAPWebService.findFileIDValueinQB() : Latest QBXML version supported = v11.0
20120924.15:11:31 UTC : QBWebConnector.SOAPWebService.findFileIDValueinQB() : Querying QuickBooks for existance of owner/file id
20120924.15:11:31 UTC : QBWebConnector.SOAPWebService.findFileIDValueinQB() : XML dump follows: -
<?xml version="1.0"?><?qbxml version="11.0"?><QBXML><QBXMLMsgsRq onError="stopOnError"><CompanyQueryRq requestID="1"><OwnerID>{57F3B9B1-86F1-4fcc-B1EE-566DE1813D10}</OwnerID></CompanyQueryRq></QBXMLMsgsRq></QBXML>
20120924.15:11:31 UTC : QBWebConnector.SOAPWebService.findFileIDValueinQB() : XML dump follows: -
<?xml version="1.0" ?>
<QBXML>
<QBXMLMsgsRs>
<CompanyQueryRs requestID="1" statusCode="0" statusSeverity="Info" statusMessage="Status OK">
<CompanyRet>
<IsSampleCompany>false</IsSampleCompany>
<CompanyName>krazykoder</CompanyName>
<LegalCompanyName>krazykoder</LegalCompanyName>
<FirstMonthFiscalYear>January</FirstMonthFiscalYear>
<FirstMonthIncomeTaxYear>January</FirstMonthIncomeTaxYear>
<CompanyType>InformationTechnologyComputersSoftware</CompanyType>
<TaxForm>Form1040</TaxForm>
<SubscribedServices>
<Service>
<Name>QuickBooks Online Banking</Name>
<Domain>banking.qb</Domain>
<ServiceStatus>Never</ServiceStatus>
</Service>
<Service>
<Name>QuickBooks Online Billing</Name>
<Domain>billing.qb</Domain>
<ServiceStatus>Never</ServiceStatus>
</Service>
<Service>
<Name>QuickBooks Online Billing Level 1 Service</Name>
<Domain>qbob1.qbn</Domain>
<ServiceStatus>Never</ServiceStatus>
</Service>
<Service>
<Name>QuickBooks Online Billing Level 2 Service</Name>
<Domain>qbob2.qbn</Domain>
<ServiceStatus>Never</ServiceStatus>
</Service>
<Service>
<Name>QuickBooks Online Billing Payment Service</Name>
<Domain>qbobpay.qbn</Domain>
<ServiceStatus>Never</ServiceStatus>
</Service>
<Service>
<Name>QuickBooks Bill Payment</Name>
<Domain>billpay.qb</Domain>
<ServiceStatus>Never</ServiceStatus>
</Service>
<Service>
<Name>QuickBooks Online Billing Paper Mailing Service</Name>
<Domain>qbobpaper.qbn</Domain>
<ServiceStatus>Never</ServiceStatus>
</Service>
<Service>
<Name>QuickBooks Payroll Service</Name>
<Domain>payroll.qb</Domain>
<ServiceStatus>Never</ServiceStatus>
</Service>
<Service>
<Name>QuickBooks Basic Payroll Service</Name>
<Domain>payrollbsc.qb</Domain>
<ServiceStatus>Never</ServiceStatus>
</Service>
<Service>
<Name>QuickBooks Basic Disk Payroll Service</Name>
<Domain>payrollbscdisk.qb</Domain>
<ServiceStatus>Never</ServiceStatus>
</Service>
<Service>
<Name>QuickBooks Deluxe Payroll Service</Name>
<Domain>payrolldlx.qb</Domain>
<ServiceStatus>Never</ServiceStatus>
</Service>
<Service>
<Name>QuickBooks Premier Payroll Service</Name>
<Domain>payrollprm.qb</Domain>
<ServiceStatus>Never</ServiceStatus>
</Service>
<Service>
<Name>Basic Plus Federal</Name>
<Domain>basic_plus_fed.qb</Domain>
<ServiceStatus>Never</ServiceStatus>
</Service>
<Service>
<Name>Basic Plus Federal and State</Name>
<Domain>basic_plus_fed_state.qb</Domain>
<ServiceStatus>Never</ServiceStatus>
</Service>
<Service>
<Name>Basic Plus Direct Deposit</Name>
<Domain>basic_plus_dd.qb</Domain>
<ServiceStatus>Never</ServiceStatus>
</Service>
<Service>
<Name>Merchant Account Service</Name>
<Domain>mas.qbn</Domain>
<ServiceStatus>Never</ServiceStatus>
</Service>
</SubscribedServices>
<AccountantCopy>
<AccountantCopyExists>false</AccountantCopyExists>
</AccountantCopy>
<DataExtRet>
<OwnerID>{57F3B9B1-86F1-4fcc-B1EE-566DE1813D10}</OwnerID>
<DataExtName>AppLock</DataExtName>
<DataExtType>STR255TYPE</DataExtType>
<DataExtValue>UNLOCKED:ADMIN-PC</DataExtValue>
</DataExtRet>
</CompanyRet>
</CompanyQueryRs>
</QBXMLMsgsRs>
</QBXML>
20120924.15:11:31 UTC : QBWebConnector.SOAPWebService.enterDataExtValueInQB() : XML dump follows: -
<?xml version="1.0"?><?qbxml version="11.0"?><QBXML><QBXMLMsgsRq onError="stopOnError"><DataExtAddRq requestID="1"><DataExtAdd><OwnerID>{57F3B9B1-86F1-4fcc-B1EE-566DE1813D10}</OwnerID><DataExtName>FileID</DataExtName><OtherDataExtType>Company</OtherDataExtType><DataExtValue>{90A44FB5-33D9-4815-AC85-BC87A7E7D1FB}</DataExtValue></DataExtAdd></DataExtAddRq></QBXMLMsgsRq></QBXML>
20120924.15:11:31 UTC : QBWebConnector.SOAPWebService.enterDataExtValueInQB() : XML dump follows: -
<?xml version="1.0" ?>
<QBXML>
<QBXMLMsgsRs>
<DataExtAddRs requestID="1" statusCode="0" statusSeverity="Info" statusMessage="Status OK">
<DataExtRet>
<OwnerID>{57F3B9B1-86F1-4FCC-B1EE-566DE1813D10}</OwnerID>
<DataExtName>FileID</DataExtName>
<DataExtType>STR255TYPE</DataExtType>
<DataExtValue>{90A44FB5-33D9-4815-AC85-BC87A7E7D1FB}</DataExtValue>
</DataExtRet>
</DataExtAddRs>
</QBXMLMsgsRs>
</QBXML>
20120924.15:11:31 UTC : QBWebConnector.SOAPWebService.enterDataExtValueInQB() : Data extension value has been created in QuickBooks for FileID
20120924.15:11:31 UTC : QBWebConnector.CompanyFileLock.Send_DataExtDefAddRqXML() : XML dump follows: -
<?xml version="1.0"?><?qbxml version="11.0"?><QBXML><QBXMLMsgsRq onError="stopOnError"><DataExtDefAddRq requestID="1"><DataExtDefAdd><OwnerID>{57F3B9B1-86F1-4fcc-B1EE-566DE1813D10}</OwnerID><DataExtName>AppLock</DataExtName><DataExtType>STR255TYPE</DataExtType><AssignToObject>Company</AssignToObject></DataExtDefAdd></DataExtDefAddRq></QBXMLMsgsRq></QBXML>
20120924.15:11:31 UTC : QBWebConnector.CompanyFileLock.Send_DataExtDefAddRqXML() : XML dump follows: -
<?xml version="1.0" ?>
<QBXML>
<QBXMLMsgsRs>
<DataExtDefAddRs requestID="1" statusCode="3100" statusSeverity="Error" statusMessage="The name "AppLock" of the list element is already in use." />
</QBXMLMsgsRs>
</QBXML>
20120924.15:11:31 UTC : QBWebConnector.CompanyFileLock.Send_DataExtAddRqXML() : XML dump follows: -
<?xml version="1.0"?><?qbxml version="11.0"?><QBXML><QBXMLMsgsRq onError="stopOnError"><DataExtAddRq requestID="1"><DataExtAdd><OwnerID>{57F3B9B1-86F1-4fcc-B1EE-566DE1813D10}</OwnerID><DataExtName>AppLock</DataExtName><OtherDataExtType>Company</OtherDataExtType><DataExtValue>UNLOCKED:ADMIN-PC</DataExtValue></DataExtAdd></DataExtAddRq></QBXMLMsgsRq></QBXML>
20120924.15:11:31 UTC : QBWebConnector.CompanyFileLock.Send_DataExtAddRqXML() : XML dump follows: -
<?xml version="1.0" ?>
<QBXML>
<QBXMLMsgsRs>
<DataExtAddRs requestID="1" statusCode="3180" statusSeverity="Error" statusMessage="There was an error when saving a data extension named "AppLock". QuickBooks error message: Attribute with specified name already exists." />
</QBXMLMsgsRs>
</QBXML>
20120924.15:11:31 UTC : QBWebConnector.SOAPWebService.AddToQuickBooks() : Application PratikWS has been added to QuickBooks.
20120924.15:11:31 UTC : QBWebConnector.SOAPWebService.DisconnectFromQB() : Session ended and connection closed
20120924.15:11:39 UTC : gridControl1_CheckBoxClicked() : Scheduling has been disabled for PratikWS
20120924.15:11:41 UTC : QBWebConnector.WebServiceManager.DoUpdateSelected() : updateWS() for application = 'PratikWS' has STARTED
20120924.15:11:41 UTC : QBWebConnector.RegistryManager.getUpdateLock() : HKEY_CURRENT_USER\Software\Intuit\QBWebConnector\UpdateLock = FALSE
20120924.15:11:41 UTC : QBWebConnector.RegistryManager.setUpdateLock() : HKEY_CURRENT_USER\Software\Intuit\QBWebConnector\UpdateLock has been set to True
20120924.15:11:41 UTC : QBWebConnector.RegistryManager.setUpdateLock() : ********************* Update session locked *********************
20120924.15:11:41 UTC : QBWebConnector.SOAPWebService.instantiateWebService() : Initiated connection to the following application.
20120924.15:11:41 UTC : QBWebConnector.SOAPWebService.instantiateWebService() : AppName: PratikWS
20120924.15:11:41 UTC : QBWebConnector.SOAPWebService.instantiateWebService() : AppUniqueName (if available): PratikWS
20120924.15:11:41 UTC : QBWebConnector.SOAPWebService.instantiateWebService() : AppURL: http://localhost:8080/TestWS/services/TestHello?WSDL
20120924.15:11:41 UTC : QBWebConnector.SOAPWebService.do_serverVersion() : *** Calling serverVersion().
20120924.15:11:41 UTC : QBWebConnector.SOAPWebService.do_serverVersion() : Actual error received from web service for serverVersion call: <No such operation 'serverVersion'>. For backward compatibility of all webservers, QBWC will catch all errors under app-not-supporting-serverVersion.
20120924.15:11:41 UTC : QBWebConnector.SOAPWebService.do_serverVersion() : This application does not contain support for serverVersion. Allowing update operation for backward compatibility.
20120924.15:11:41 UTC : QBWebConnector.SOAPWebService.do_clientVersion() : *** Calling clientVersion() with following parameter:<productVersion="2.1.0.27">
20120924.15:11:41 UTC : QBWebConnector.SOAPWebService.updateWS() : Actual error received from web service for clientVersion call: <No such operation 'clientVersion'>. For backward compatibility of all webservers, QBWC will catch all errors under app-not-supporting-clientVersion.
20120924.15:11:41 UTC : QBWebConnector.SOAPWebService.do_clientVersion() : This application does not contain support for clientVersion. Allowing update operation for backward compatibility.
20120924.15:11:41 UTC : QBWebConnector.SOAPWebService.do_authenticate() : Authenticating to application 'PratikWS', username = 'pratik'
20120924.15:11:41 UTC : QBWebConnector.SOAPWebService.do_authenticate() : *** Calling authenticate() with following parameters:<userName="pratik"><password=<MaskedForSecurity>
20120924.15:11:41 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
20120924.15:11:41 UTC : QBWebConnector.RegistryManager.setUpdateLock() : HKEY_CURRENT_USER\Software\Intuit\QBWebConnector\UpdateLock has been set to False
20120924.15:11:41 UTC : QBWebConnector.RegistryManager.setUpdateLock() : ********************* Update session unlocked *********************
20120924.15:11:41 UTC : QBWebConnector.WebServiceManager.DoUpdateSelected() : Update completed with errors. See log (QWClog.txt) for details.