从WIN32 Delphi应用程序中使用ADO.NET数据服务。怎么样?

时间:2022-06-28 23:05:23

Simple. I created a LINQ-TO-SQL Entity model, created a website, added a Data Service (*.svc) to this site and made sure it works by writing a simple .NET console application. The service works fine and cannot be modified.

简单。我创建了一个LINQ-TO-SQL实体模型,创建了一个网站,向该网站添加了一个数据服务(* .svc),并通过编写一个简单的.NET控制台应用程序确保它的工作原理。该服务工作正常,无法修改。

Now I'm going to write a Delphi application (2007) for WIN32 which will have to call this data service. And while Delphi has no major problems importing a SOAP service, it can't import this service since it provides no WSDL...

现在我要为WIN32编写一个Delphi应用程序(2007),它必须调用这个数据服务。虽然Delphi没有导入SOAP服务的主要问题,但它不能导入此服务,因为它不提供WSDL ...

So, two options. I could figure out how to generate a WSDL based on this data service or I'll have to find another way to consume this service. (Or just give up, but I hate to quit this challenge.) So, any advise?

所以,有两种选择。我可以弄清楚如何基于这个数据服务生成WSDL,或者我必须找到另一种方法来使用这个服务。 (或者只是放弃,但我讨厌退出这个挑战。)那么,有什么建议吗?

3 个解决方案

#1


ADO.NET Data Services are REST services. They are not SOAP WebServices and I don't think REST uses WSDL. You can call REST services from Delphi using HTTP GET/PUT/POST/DELETE. You could use Indy's TIdHTTPClient. See http://msdn.microsoft.com/en-us/library/cc668786.aspx for url examples. The results are in the Atom format, which is a XML format. You could parse it with TXMLDocument. They can also return JSON.

ADO.NET数据服务是REST服务。它们不是SOAP WebServices,我认为REST不使用WSDL。您可以使用HTTP GET / PUT / POST / DELETE从Delphi调用REST服务。你可以使用Indy的TIdHTTPClient。有关url示例,请参阅http://msdn.microsoft.com/en-us/library/cc668786.aspx。结果采用Atom格式,这是一种XML格式。你可以用TXMLDocument解析它。他们也可以返回JSON。

#2


Maybe you can use the project Jedi "url grabber" components to consume the service. I have managed to get live share data using these in the past. I do not know exactly how your setup works, but maybe these can be helpful.

也许您可以使用项目Jedi“url grabber”组件来使用该服务。我过去曾设法使用这些获取实时共享数据。我不确切知道你的设置是如何工作的,但也许这些可能会有所帮助。

http://www.delphi-jedi.org/

#3


You should also look at synapse, a small easy to use library which works well with REST. The latest version, which can be downloaded via SVN, works well in Delphi 2009.

您还应该看一下synapse,这是一个易于使用的小型库,可以很好地与REST配合使用。最新版本可以通过SVN下载,在Delphi 2009中运行良好。

#1


ADO.NET Data Services are REST services. They are not SOAP WebServices and I don't think REST uses WSDL. You can call REST services from Delphi using HTTP GET/PUT/POST/DELETE. You could use Indy's TIdHTTPClient. See http://msdn.microsoft.com/en-us/library/cc668786.aspx for url examples. The results are in the Atom format, which is a XML format. You could parse it with TXMLDocument. They can also return JSON.

ADO.NET数据服务是REST服务。它们不是SOAP WebServices,我认为REST不使用WSDL。您可以使用HTTP GET / PUT / POST / DELETE从Delphi调用REST服务。你可以使用Indy的TIdHTTPClient。有关url示例,请参阅http://msdn.microsoft.com/en-us/library/cc668786.aspx。结果采用Atom格式,这是一种XML格式。你可以用TXMLDocument解析它。他们也可以返回JSON。

#2


Maybe you can use the project Jedi "url grabber" components to consume the service. I have managed to get live share data using these in the past. I do not know exactly how your setup works, but maybe these can be helpful.

也许您可以使用项目Jedi“url grabber”组件来使用该服务。我过去曾设法使用这些获取实时共享数据。我不确切知道你的设置是如何工作的,但也许这些可能会有所帮助。

http://www.delphi-jedi.org/

#3


You should also look at synapse, a small easy to use library which works well with REST. The latest version, which can be downloaded via SVN, works well in Delphi 2009.

您还应该看一下synapse,这是一个易于使用的小型库,可以很好地与REST配合使用。最新版本可以通过SVN下载,在Delphi 2009中运行良好。