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).
It sounds like you may be wedded to an MS stack but if you're not, you can use restSQL in a Java EE container (Tomcat, WebLogic, etc.) on top of MySQL or PostgreSQL. restSQL has a full HTTP API with JSON or XML encoding. It offers two twists: updatable composite views and hierarchical composite views. The framework is extensible to other databases and addition of SQL Server is in its supported evolution. Check out http://restsql.org.
Another option is something like Dreamfactory. They have a SOAP to REST solution that allows you to connect to any database or service. I have used their free hosted solution in the past for projects. They also have an open source solution available. The cool thing about the service is that they use Swagger 3.0 to create service definitions in a nice front-end solution so you can test and create new endpoints.
I have used the OpenAPI 3.0 definitions to connect to 3rd party SOAP and REST services as well. They also support stored procedures and server-side scripting in the SQL Server environments.
Anyways, might be another option for you.
Related
I came from Parse to Azure and faced the problem with Azure Mobile Services. When I'm trying to setup data tables in the browser it is possible to add attributes with 4 types only, such as String, Number, Date and Boolean. It is not enough for me.
Can anyone help me how can I obtain other types (BLOB, Pointer, etc.)?
I'm new to Azure and working with OSX.
The best way to manage blobs is through azure blob storage you can find how to do this through https://azure.microsoft.com/en-us/documentation/articles/storage-ios-how-to-use-blob-storage/
The best way to manage the tables is through Microsoft Management Studio and connect it to Azure SQL Database.
If you are coming from Parse, why not continue to use Parse?
See: https://azure.microsoft.com/en-us/blog/azure-welcomes-parse-developers/
Azure Mobile Apps / Services both deal with SQL Database Tables - if you are on an ASP.NET backend, you can support anything that Entity Framework supports. However, SQL databases tend to be more involved than most Parse developers are used to.
If you are just switching, but want to use the same development experience, just continue using Parse Server.
I'm a newbie at SOAP and web services (2 day experience).
I use Bonita Open Solution as a BPMS in which I have a 'WebServer SOAP 1.2' connector. I need to get and write data from/into a database using SOAP. I don't want to use the 'SQL Server' connector which is based on JDBC because the system will be tightly-coupled.
Is there any already implemented SOAP web service in SQL Server 2008 to do that or should I develop my own? In case I should develop my own, I'm guessing the best way to do so is using ASP.NET, am I right?
Before you do anything, you need to decide exactly which data is required by the BPMS system and what access it requires. For instance, it may need read access to some data, but read and write to other data. Your service should only expose the data and operations which are actually required, and nothing more.
Your data is precious - don't expose more of it than necessary.
I recommend that you use Entity Framework in a database-first mode, but only add the required tables to the model. Then, simplify the model by removing columns which are not required, simplifying relationships, etc. Thus, you are exposing a conceptual model of your data which makes sense to the consumer, rather than having to expose every implementation detail of your database (do you really need to expose every junction table, for instance?)
It is then pretty simple to write a WCF service that uses Entity Framework to do the hard work of data access.
Even if deprecated, Sql Server 2008 has native SOAP web services (see Native XML Web Services: Deprecated in SQL Server 2008).
You need to balance the risk of a Sql Server upgrade against the cost of developing (and maintain) a custom service.
I have decided to learn Silverlight, but apart from knowing how to write apps, I also need to know how to connect to a remote server to fetch data. I have seen some examples of database connection in .NET, but I am rather confused by which way to go.
My generic question is how do SL applications connect to remote servers? You could post a subjective response if you like, but this question should be objective in that I want to learn about the possible ways of creating a connection to a remote SQL server.
Where do these (WCF, XML, Ajax, Linq to SQL, Entity Framework, data access providers, and so on) come in handy? If one wants to establish robust and secure connections, which one of those (or others) are a must-learn? I'd like to grab a book and learn stuff, but before I do that, I need to know what to invest my time in.
Silverlight, being a browser technology, doesn't do direct SQL Server connections. Most SL apps speak HTTP to a server (REST, SOAP, POX)- other options are available, but much more limited than with the "big" .NET Framework.
Probably the easiest way to go for a beginner is .NET RIA Services. It allows simple exposure of various kinds of models built off databases (LINQ to SQL, Entity Framework, etc). LINQ to SQL is the simplest on the model side if you're talking to SQL Server, though EF is fine too (a bigger, more complex hammer). RIA Services will allow you to expose table objects from your model over a web service, and the Silverlight client can consume data through LINQ queries that are remoted back to the server (very efficient- the query criteria lives on the client, while the data filtering happens on the server, and it's all compile-time type-checked against the model, so it's much harder to screw datatypes and queries up or expose yourself to SQL injection attacks). RIA Services will also let you apply various security options and data validation on both ends, and the full power of WCF is available to you if you go lower level and do something RIA can't.
This question is an updated version of a previous question I have asked on here.
I am new to client-server model with SQL Server as the relational database. I have read that public access to SQL Server is not secure. If direct access to the database is not a good practice, then what kind of layer should be placed between the server and the client? Note that I have a desktop application that will serve as the client and a remote SQL Server database that will provide data to the client. The client will input their username and password in order to see their data. I have heard of terms like VPN, ISA, TMG, Terminal Services, proxy server, and so on. I need a fast and secure n-tier architecture.
P.S. I have heard of web services in front of the database. Can I use WCF to retrieve, update, insert data? Would it be a good approach in terms of security and performance?
A web-service tier is pretty common for smart-clients as a layer between the user-client and the server. This allows:
simple networking (http only)
you have an app-layer in which to put validation etc without upsetting the db
you can have security that isn't tied to the db
the db can run as fewer accounts (app accounts), allowing greater connection pooling
you can "scale out" the app layer
you can cache etc above the db
you can have a richer app layer, with more services than sql server provides
the client has a known API, and never knows about the db (which is an implementation detail)
You can use WCF to talk to the app layer, but you shouldn't think in terms of "INSERT", "UPDATE" etc - you should think in terms of operations that make sense to your domain model - the "CreateOrder" operation, etc. ADO.NET Data Services allows an API more similar to your "INSERT" etc, but it isn't necessarily as controlled as you might like for a secure service.
Performance is really a factor of "what queries am I running?" and "how much data am I transferring?". As long as you keep the operations sane (i.e. don't fetch the entire "Orders" data over the wire just to find the most recent order-date), then you should be OK.
I am trying to set up a basic Silverlight application to run behind the firewall on my Windows XP machine with IIS 5.1. We have a MySQL server for production purposes, but I would like to set up SQL Server 2008 Express Edition on my Windows XP machine to host the database part of the application.
I'm completely new to a lot of .NET develoment but would like to find the resources to get started. I've checked out Silverlight.net/GetStarted/, but unless I missed something there, this step wasn't explicitly there.
Does anyone know where I could go to read about how to do this and maybe a simple walthrough of a sample Silverlight application written to access SQL Server 2008 Express?
Any suggestions and links would be much appreciated.
There are 3 options that I know of for connecting to a database from Silverlight:
WCF: Create your own WCF service with methods like GetCustomers(), UpdateCustomers() and DeleteCustomers(). Those methods are implemented on the server side, so in the background you can use LINQ to SQL or just open an old-fashioned SqlConection and run some SqlCommands against the database.
ADO.NET Data Services: This is a custom WCF service implemented by MS. You point the service at an Entity Framework class (auto generated from your custom database, super easy to create) and in turn it'll accept standard http rest commands that that do things like GetCustomers/Update/Delete. You can then add a service reference to this guy from your Silverlight app and it will auto generate 1 class per table, etc along with a client to connect to the server (http port 80 so no firewall concerns here). On the client side you're interacting with rich classes that look just like your database structure and work well with LINQ. This is not Silverlight specific and could be used from any client, even a console app.
.NET RIA Services: This is like ADO.NET Data Services but adds support for many things Silverlight including property change notification on the client side (note that the bleeding edge CTP2 of ADO.NET Data Services also implements change notifications), easy to hook events for browser navigation (i.e. you get an event when the user clicks back or forward) and code sharing between the server and the client (just name your file MyClass.shared.cs in your ASP.NET application and it magically shows up in your Silverlight client).
All of these options use http port 80 so they'll work well with your firewall. I'd really encourage you to try all 3 if you've got the time. If you don't have the time go directly to ADO.NET Data Services (grab the CTP2 you'll appreciate the new features).
Plain vanilla SL + WCF + SQL, but it's a little old:
http://msdn.microsoft.com/en-us/magazine/cc794260.aspx
Shawn Wildermuth's MSDN article is a good starting point for ADO.NET Data Services:
http://msdn.microsoft.com/en-us/magazine/dvdarchive/cc794279.aspx
This will get you up and running with good results in short time but note that it uses beta software. You'll see how many improvements have been made to ADO.NET DS since Shawn wrote that previous article:
http://blogs.msdn.com/astoriateam/archive/2009/09/01/introduction-to-data-binding-in-ctp2.aspx
And here's Brad Abram's mother of all data connectivity posts (RIA Services focus here - I think the series is up to 24 parts now):
http://blogs.msdn.com/brada/archive/2009/08/02/business-apps-example-for-silverlight-3-rtm-and-net-ria-services-july-update-summary.aspx