python - qbxml event subscription behaving erratically -
i tried receive notifications when sales receipts created in quickbooks. qbxml:
<?xml version="1.0" encoding="utf-8"?> <?qbxml version="13.0"?> <qbxml> <qbxmlsubscriptionmsgsrq> <dataeventsubscriptionaddrq> <dataeventsubscriptionadd> <!-- required --> <subscriberid >{d8a63411-5965-4701-b2d6-eda9b2f938da}</subscriberid> <!-- required --> <comcallbackinfo> <!-- required --> <appname >testapp</appname> <!-- required --> <progid>callback.server</progid> <!-- optional --> </comcallbackinfo> <!-- deliverypolicy may have 1 of following values: deliveralways, deliveronlyifrunning --> <deliverypolicy >deliveralways</deliverypolicy> <!-- required --> <txneventsubscription> <!-- optional, may repeat --> <!-- txneventtype may have 1 of following values: arrefundcreditcard, bill, billpaymentcheck, billpaymentcreditcard, charge, check, creditcardcharge, creditcardcredit, creditmemo, deposit, estimate, inventoryadjustment, invoice, itemreceipt, journalentry, purchaseorder, receivepayment, salesorder, salesreceipt, salestaxpaymentcheck, timetracking, vendorcredit --> <txneventtype >salesreceipt</txneventtype> <!-- required, may repeat --> <!-- txneventoperation may have 1 of following values: add, modify, delete --> <txneventoperation >add</txneventoperation> <!-- required, may repeat --> </txneventsubscription> </dataeventsubscriptionadd> </dataeventsubscriptionaddrq> </qbxmlsubscriptionmsgsrq> </qbxml> in comcallbackinfo tag have specified callback progid callback.server. callback server python script:
import win32com.server.register import ctypes class srv: _reg_clsid_ = "{7cc9f362-486d-11d1-bb48-0000e838a65f}" _reg_desc_ = "python test com server" _reg_progid_ = "callback.server" if __name__ == "__main__": win32com.server.register.usecommandline(srv) ctypes.windll.user32.messageboxw(0, "you created sales receipt", "congrats", 1) i sent qbxml using sdktestplus3 bundled sdk. first time sent qbxml, worked fine, , received "status ok" response quickbooks. if tried sending qbxml again, got following response:
<?xml version="1.0" ?> <qbxml> <qbxmlsubscriptionmsgsrs> <dataeventsubscriptionaddrs statuscode="3180" statusseverity="error" statusmessage="there error when saving subscription. " /> </qbxmlsubscriptionmsgsrs> </qbxml> i figured because subscription saved, when used "subscription viewer" bundled sdk, says no subscriptions exist.
to add confusion, when start quickbooks , save first sales receipt, callback application works (i see little popup)... once. sales receipts save after not anything, have restart quickbooks work again.
any appreciated!!!
Comments
Post a Comment