Presentation is loading. Please wait.

Presentation is loading. Please wait.

Creating a RESTful Web Service for Microsoft SQL Server Patrick Mundy, Managing Partner Albert Factora, Managing Partner.

Similar presentations


Presentation on theme: "Creating a RESTful Web Service for Microsoft SQL Server Patrick Mundy, Managing Partner Albert Factora, Managing Partner."— Presentation transcript:

1

2 Creating a RESTful Web Service for Microsoft SQL Server Patrick Mundy, Managing Partner Albert Factora, Managing Partner

3 About The Presenters Albert Factora RocketWeave co-founder Angry Lumpia inventor Patrick Mundy RocketWeave co-founder Kick-ass drummer

4 About RocketWeave

5 Our mission: ensure that your business systems are primed for a successful take-off!

6 Problem Statement Web Service MSSQL Database Server ?? PHP / IIS ONE AWS Instance

7 Common Alternative Platforms Spin up a virtual LAMP stack Spin up a virtual WAMP stack Others…? This presentation presumes a Microsoft shop where MS SQL and IIS are the supported platforms…

8 Agenda Background RESTful architecture overview, JSON overview, Requirements Preparation Installation Process, Configuration Issues Demo Review SQL Data, PHP File architecture Fire off some GET, POST calls Observe behavior Conclusion It can be done App Design thoughts…

9 Background: RESTful principles for web services Architectural Properties Performance Scalability Simplicity of interfaces Modifiability of components Visibility of communication between components Portability of components Reliability Made from: Components, Connectors, and Data “Representational State Transfer”

10 Background: RESTful principles for web services HATEOAS Hypertext As The Engine Of Application State ENDPOINTS Collections / Methods Elements / Methods

11 Background: RESTful principles for web services Hypertext As The Engine Of Application State Client context not stored on Server Client initiates state-change via request to Server PUT and DELETE are idempotent GET is nullipotent (i.e. safe method)

12 RESTful Design of the Demo /Categories GET – returns list of Members of Category Collection POST – (with data) creates a new Member of the Category Collection /Categories/:catID GET – returns data for just the selected Member /Categories/Level/:lvl GET – returns Members of “lvl” Level Collection

13 Transmittal Attributes Method GET PUT POST DELETE Optional: data to work with (JSON- encoded) $.post('http:// /api/?q=players', { username:'test1abc', password:'pwd123', });http:// /api/?q=players

14 Background: JSON Review “Javascript Object Notation”: Text-Based Data Interchange Format { Attribute1 / Value Attribute2 / Value } Address Attribute’s Value is a nested JSON object phoneNumbers Attribute’s Value is a LIST of two more small JSON objects

15 Background: System Architecture MSSQL Database Server PHP executable PHP index file PHP include files PHP extension files Windows 2008 R2 DataCenter 7.5 Gig memory 64 bit OS IIS 7 PHP VC9 binary, thread safe v ts

16 Background: PHP File Architecture php.ini php extension files (.dlls) (including mssql support files) index.php routes.php sql.php db.php

17 Preparation: Installation Process Overview Assumptions: SQL Server and IIS are installed 1.Install PHP 2.Install SQL Server PHP extension 3.Configure php.ini files for IIS 4.Configure IIS for PHP 5.Install SQL Server 2012 Client 6.Build, test DB Connection logic 7.Build t-SQL creation logic 8.Build logic to parse “payload” of GET/PUT/POST

18 Preparation: Install PHP Determine the version of PHP to use, based on IIS version Download binaries Unzip You may need to install C++ runtime

19 Preparation: Install MSSQL Drivers for PHP PHP page about this: Microsoft page about this: Download drivers (most likely SQLSRV 3.0) Place them in the IIS Extensions folder Decide which one you will have IIS load: ing-sql-server-databases-from-php.aspx ing-sql-server-databases-from-php.aspx

20 Preparation: Configure php.ini Instructions are on second half of PHP install page: Stipulate extension file location Stipulate which extensions to use (especially correct MSSQL extension) Set up logging and log output CGI and FastCGI settings

21 Preparation: Configure IIS for PHP PHP page about this: Enable FastCGI support in IIS Configure IIS to process PHP requests php.ini settings taken care of in prior slide Set up “handler mapping” for PHP inside IIS Manager Set up impersonation and file access Set up IIS to use “index.php” as default document

22 Preparation: Install MSSQL 2012 Client And from there to: us/download/confirmation.aspx?id= us/download/confirmation.aspx?id=29065 It’s about halfway down the page AFTER you expand the “installation instructions.” Most of us want x64 version

23 Demo: Review SQL Data, Procedures Select * from CategoriesExec usp_ShowLevelMembers 2 Exec usp_NewCategory

24 Demo: Review PHP files \PHP\php.ini \inetpub\wwwroot\index.php \inetpub\wwwroot\restful_routes.php \inetpub\wwwroot\restful_sql.php \inetpub\wwwroot\restful_db.php

25 Demo: Execute Some GETs /Categories -- shows list of Members of Category Collection /Categories/:catID -- shows data for just the selected Member /Categories/Level/:lvl -- shows Members of “lvl” Level Collection

26 Demo: Execute a POST /Categories {parentID=1, catName = ‘Coffee Shops’}

27 Recap Background RESTful architecture overview, JSON overview, Requirements Preparation Installation Process, Configuration Issues Demo Review SQL Data, PHP File architecture Fire off some GET, POST calls Observe behavior

28 Conclusions

29 (415)


Download ppt "Creating a RESTful Web Service for Microsoft SQL Server Patrick Mundy, Managing Partner Albert Factora, Managing Partner."

Similar presentations


Ads by Google