德尔福5专业版
Intraweb 7
我有一个 Intraweb 应用程序,它使用“传统”后端(B-Tree Filer)和 TDataSet 后代来处理数据访问。我这边一切都很好。
但是,我现在有一些外部网站请求访问我的数据。我已经完成了简单的 HTML 表单 Posts 和 Gets 作为通信工具来处理与其他站点的一些集成,但其中一个请求现在要求我发回数据“表”。表的每一行代表一条单独的记录。
我怎样才能用我当前的设置来完成这个任务?我会用 XML 文档回发并让其他站点自行处理“表格”吗?是否有一个可以在 Delphi 中使用的等效数据集(如数据集的 VB 或 .Net 世界定义),如果有,我将如何将其发送回发出请求的站点?
任何想法和建议将不胜感激。
Delphi 5 Pro
Intraweb 7
I have an Intraweb application that uses a "legacy" back end (B-Tree Filer) with a TDataSet descendant to handle the data access. All is fine and dandy on my end.
But, I now have some outside websites requesting to access my data. I've done simple HTML Form Posts and Gets as a communication tool to handle some integration with other sites but one of the requests is now asking me to send a "table" of data back. Each row of the table represents an individual record.
How could I accomplish this with my current setup? Would I POST back with a XML document and let the other site handle the "table" on their end? Is there a DataSet (as in the VB or .Net world definition of Dataset) equivalent I could use in Delphi and if so, how would I send it back to the site making the request?
Any thoughts and suggestions would be greatly appreciated.
发布评论
评论(2)
HTTP POST(返回给对方)是一个好主意,使用异步操作允许在 HTTP 请求的外部运行数据收集和转换。 (参见演示文稿的幻灯片 4“Dopplr:这是由消息组成”,作者:Matt Biddulph)
您的服务器将收到一个小的 HTTP GET 请求(类似于
/context/loaddata?table=TABLENAME&from=1000&records=100
),存储此请求并立即返回带有简单OK。
然后,您的服务器将收集并准备(XML 或 JSON 编码的)表数据,最后将包含此文档的 HTTP POST 发送到另一方的 Web 服务器。如果此操作失败,可以轻松重试,直到其他服务器返回“OK”。
因此,如果数据准备和转换需要很长时间,当您的服务器忙于获取和转换数据时,另一方将不必等待(并且可能会遇到请求超时)。
A HTTP POST (back to the other party) is a good idea, using an asynchronous operation allows to run the data collection and conversion outside of the HTTP request. (See slide 4 of the presentation "Dopplr: It's made of messages" by Matt Biddulph)
Your server would receive a small HTTP GET request (something like
/context/loaddata?table=TABLENAME&from=1000&records=100
), store this request and immediately return a response with a simpleOK
.Then your server would collect and prepare the (XML or JSON encoded) table data and finally send a HTTP POST with this document to the other party's web server. If this operation fails, it can be easily retried until the other server answers with a OK.
So if data preparation and conversion takes a long time, the other party would not have to wait (and maybe experience a request timeout) while your server is busy fetching and converting the data.
首先,我想知道对方正在使用什么(PHP、Java 等),以及 SOAP/XML、JSON/REST 等是否已经“在他们知道如何做的事情列表中”。然后我就同意了。
您可能需要为他们提供 SOAP 或 JSON 服务器服务,或其他一些自定义文档(HTML/XML/JSON 等),否则以他们可以读取的格式向他们提供原始数据,并为他们提供他们想要的 URL需要知道如何获取这些数据,这显然是为他们准备的,而不是为使用一般浏览器访问您网站的公众准备的。
First, I would like to know what the other side is using (PHP, Java, etc), and whether or not SOAP/XML, JSON/REST, etc are already "in their list of things they know how to do". Then I would go with that.
You may need to provide for them, either a SOAP or JSON server service, or some other custom document (HTML/XML/JSON etc) otherwise provide raw data to them in a format they can read, and give them the URLs that they would need to know to get at this data, which you obviously intend for them, instead of for the general browser-using public accessing your website.