为什么 Web 服务提供公司文件名?

Why is the company file name supplied by the web service?

我了解要访问当前未在 QuickBooks 中打开的公司,Web 服务需要向 QuickBooks Web 连接器提供文件位置作为 return 值以调用 authenticate()

这对我来说似乎倒退了。为什么 Web 服务要负责告诉 Web 连接器相关公司文件在哪里?由 Web 连接器管理它不是更有意义吗?

这是我在 QuickBooks Web 连接器中找到的相关解释 程序员指南:

  1. IF your web service wants to try a different company, supply the company pathname in the returned string. (You can supply an empty string if you want to use whatever company file happens to be open.) The web connector will respond by attempting to connect to QuickBooks again using that supplied string.

Why Would a Web Service Try a Different Company?

Why would a web service perform the second of these actions instead of simply just stopping altogether? In practice this approach is used when the web service remembers the company file path from session to session (a recommended practice) and wants to have a fall-back to use whatever company file is currently open in QuickBooks (by responding to the connectionError call with an empty string).

This is not as haphazard as it might seem. When a web service is added to the web connector, the web connector stores a unique FileID as a private data extension in the specified company. As a result, the web service can always verify that it is talking to the expected company file simply by checking the CompanyRet returned to your web service in the web connector’s first sendRequestXML call in the data exchange sequence. (Check the data extension list for the expected FileID.)

这似乎是一种糟糕的最终用户体验;如果他们移动公司文件(假设他们希望 Web 连接器在不打开 QuickBooks 的情况下运行),则 Web 服务将失败,直到在服务器端更新该路径。最终用户可以在不知道它会破坏东西的情况下这样做似乎是完全合理的。

为什么是这样的结构?更重要的是:有解决办法吗?

Why is it structured this way?

因为 Intuit 就是这样构建它的。

is there a way around this?

没有。