如何通过REST查询SQL Server来获取XML [英] how to query SQL Server via REST to get XML

查看:214
本文介绍了如何通过REST查询SQL Server来获取XML的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们一直在使用Web应用程序框架来构建需要能够查询SQL Server数据库并将结果作为XML获取的应用程序。



过去,框架提供了这种能力。但是这个功能现在已被弃用。



所以我们想,框架允许我们通过HTTP轻松查询REST服务,所以为什么不使用SQL Server HTTP端点。但是,我们随后读到了不推荐使用HTTP端点,从SQL Server 2008开始。不是一个可以为将来设计架构的平台。



Azure(以前的SQL数据)服务)将提供类似的服务,但现在只支持TDS协议,而不是http。因此,在Azure中找不到REST。



建议的替代方法是使用WCF数据服务(以前称为ADO.NET数据服务)开发自定义应用程序。但这意味着需要开发,部署和维护一个完整的附加应用程序,可能是它自己的身份验证设置与SQL Server分开,以及它自己的源代码库...使用我们没有经验的技术,因此有自己的漂亮深度学习曲线。



你能否建议通过REST / HTTP查询SQL Server数据库的任何其他方法,这种方式不被弃用,并且会以XML格式返回结果? / p>

感谢您的帮助。

解决方案

在这里阅读:在30分钟内为StackOverflow创建包含XML和JSON的OData API 。基本上,前进的道路是由应用层提供REST(WCF驱动提供OData映射的EF)。恕我直言HTTP访问引擎是一个非常糟糕的想法开始,没有人喜欢SQL Server 2005的HTTPEndpoints,他们是误入歧途。无法将HTTP错误模型,安全性,类型系统映射到SQL中,并期望顺利的互操作性。让HTTP层位于专用应用程序中会将处理HTTP生态系统的责任推向专门用于该(WCF)的组件,以及将REST模型映射到专用于该作业(EF)的组件中的DB模型的逻辑。 / p>

We have been using a web application framework to build apps that need to be able to query a SQL Server database and get the results as XML.

In the past, the framework provided that capability. But that capability is now deprecated.

So we were thinking, the framework allows us to easily query a REST service over HTTP, so why not use a SQL Server HTTP Endpoint. However, we then read that HTTP Endpoints are deprecated, as of SQL Server 2008. Not a platform on which to design an architecture for the future.

Azure (formerly SQL Data Services) was going to offer similar services, but now only supports the TDS protocol, not http. So no REST to be found in Azure.

The suggested alternative is to develop a custom app using WCF Data Services (formerly ADO.NET Data Services). But that would mean a whole additional app to develop, deploy, and maintain, presumably with its own authentication setup separate from SQL Server's, and its own source code repository... using a technology we have no experience with, therefore with its own pretty deep learning curve.

Can you suggest any other way to query a SQL Server database via REST/HTTP, that is not deprecated, and that would return results as XML?

Thanks for any help.

解决方案

Read here: Creating an OData API for StackOverflow including XML and JSON in 30 minutes. Basically, the road forward is for REST to be offered by app layer (WCF powering EF that provides the OData mapping). IMHO straight HTTP access into the engine was a very bad idea to start with, nobody liked the HTTPEndpoints of SQL Server 2005 and they were as misguided as it gets. One cannot map the HTTP error model, security, type system into SQL and expect a smooth interoperability. Having the HTTP layer live in a dedicated app pushes the responsibility of handling the HTTP ecosystem into a component specialized in that (WCF), and the logic of mapping the REST model to the DB model ina component specialized in that job (EF).

这篇关于如何通过REST查询SQL Server来获取XML的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆