Take control of your SAP testing with UiPath Test Suite
W8/WP8 App Dev for SAP, Part 2: Microsoft OData Application Development
1. Microsoft OData Application Development
• Joyanta Sen
• Senior Consultant
• Microsoft
SAP and Microsoft Mobility
Developer Workshop
2. Agenda
1.OData in Microsoft applications
2.Visual Studio application development using
OData
3.SharePoint 2013 App Development with
OData and SAP
3. Microsoft SharePoint 2013: REST endpoints
- Access to data
- CRUD
- Ex:
_api/web/lists/getByTitle('Announcements')
BizTalk Server 2013: using the new WebHttp
adapter
Excel 2013: OData Source
CRM2011: REST is available within the custom
components to query entities
4. Why is REST Important?
• Significant Industry Momentum
• Simpler and Easier to Use
– Much easier to use than SOAP-based Web service
– Higher productivity when using JavaScript and jQuery
– Results can be returned in JSON and ATOM format
• Each query is submitted with a unique URL
– Results can be cached by proxy servers
5. ODATA Primer
• “THE” New Data Access API for HTTP-based Clients
– Based on open specification growing in popularity
– Standardizes Data Access APIs for CRUD operations
– OData services are emerging on Internet (NetFlix, Dallas, Azure)
– OData clients becoming more popular as well
27. HTML 5 / CSS 3
JavaScript, OAuth, OData
On Premises
Web Services
SharePoint
Dynamics
SAP
Proprietary Systems
Expense Reporting
Forecasting
Cloud
Web Services
Office 365
Yammer
Linkedin
Azure Services
SharePoint ISV
Other ISV
New cloud app model
28. Types of Apps for Office
• Task Pane App for Office (Document-centric)
Assists user working with one or more documents
Works in Word, Excel and Project
• Content App for Office (Document-centric)
Adds embedded content/functionality into document
Only used in Excel Application and Excel Web Application
• Mail App for Office (Mailbox-centric)
Outlook Client and Outlook Web App (OWA)
Extends Outlook items with custom UI and behaviors
Outlook items can be messages and events
Require Exchange 2013
29. App for Office Anatomy
• Each App for Office is based on XML-based manifest
Manifest points to a Web page
Manifest defines the type of the App for Office
Manifest defines which Office applications it supports
Manifest defines required capabilities
App for Office
Manifest
<XML>
Web
Page
HTML+JS
App for Office
Catalog Server Web Server
App for Office
Most of our products are new REST aware. We support REST both as server and clients.For instance, in Excel, you have a new OData data source.
Over the last few years REST-based Web services have become increasing popular through the IT industry and particularly within Microsoft. REST-based Web services are much easier to use than SOAP-based Web service and therefore lower the barrier of entry to different types of potential clients. REST-based Web services are also much easier to call from JavaScript code especially when using the jQuery library.
OData is quickly becoming the industry’s new data access API. It’s popularity is based on the fact that it is the first mainstream data access API for HTTP-based Clients. OData serves to standardize performing CRUD (Create, Read, Update, Delete) operations from across the network using HTTP verbs such as GET, PUT and POST.OData services are becoming more popular on the Internet. Examples of OData services include NetFlix, Dallas, and the Azure Data Mart. Client application such as Excel 2010 and Excel 2013 are examples of client application that can consume data from any OData-based data source.
This slides lists and describes a few of the most important terms you will encounter when starting the learn how OData works.
InODatawe have client and Server. Clients canbedevelopped in different technologies, thisis the power of OData. Ex: WCF Server and PHP/JavaScript.Usingtraditional SOAP based WS, weneed to parse the XML and generate a proxy, lot of data, with Data, the structure issimplified. In Javascript, isisalsoeasy to get a collection of a JSON structure.In ourdemostoday, wewill consume data from SAP withouthavinganyknowledge of the backend. SAP willpresent the data model and wewill consume itusingdifferentkind of clients.
One of the best parts of REST is that it simplifies calling Web service operations. All you need is a browser that can authenticate against a SharePoint 2013 site and you can simply run queries by typing the REST-based URIs for HTTP GET operations. This becomes a fast and easy way for you to learn how to put together URIs that query, filter and sort content from SharePoint sites.
When you run REST-based queries against SharePoint 2013 sites, you have the option of having the data returned as either XML in the ATOM format or JSON (JavaScript Object Notation). The default behavior is to return XML but you can change this default behavior to return JSON by including the ACCEPT header with a value of "application/json". If you include the ACCEPT header with an explicit value of "application/atom+xml", this has the same result as the default behavior in that the results are returned as ATOM-based XML.As a general rule of thumb, it is easier to deal with XML-based results when writing managed code such as C# or VB.NET. Likewise, it is easier to deal with JSON results when programming with JavaScript. Note that jQuery makes dealing with JSON results even easier.
If you are making REST calls into SharePoint 2013 using C# or VB.NET, there are a few tips to make things easier. First, .NET 4.0 added a two new classes named HttpWebRequest and HttpWebResponse which provide a few conveniences not offered by their base classes WebRequest and WebResponse. For example, there is a stongly-typed Accept property on the HttpWebRequest object that allows you to set the ACCEPT header.When it's time to retrieve data values from elements within an XML document, it's time to abandon older XML APIs such as XMLReader in favor of Linq to XML and the XDocument class. Retrieving data from an XML document using the Descendants property of an XDocument object as shown above makes dealing with nested elements and XML namespaces so much easier.
If you are executing REST-basedqueries against SharePoint 2013 sites using JavaScript, the first piece of advice is to use jQuery because it simples returning and processing JSON result sets. The code above uses the jQuery function $.getJSON which automatically sets the ACCEPT header to return a JSON result set. When jQuery calls the callback method (OnDataReturned in this example) it passes a data parameter which represents that JSON results set which has already been converted from a string into JavaScript objects.
The primary purpose of OData is to map CRUD operations to HTTP verbs. For example, you can query data using an HTTP GET. You can add new entries (e.g. list items, database records) using an HTP POST. Updates are performed using either anHTTP PUT or an HTTP MERGE. You can delete entries using an HTTP DELETE.The advantage of the HTTP Merge over the HTTP PUT for updates is that you can update some columns while leaving others with their original value. Updating an entry with HTTP PUT operation will reset any column not explicitly assigned a value back to the default value.
To understand how to use OData as a developer, you must understand how OData URIs are constructed. Each URI has three significant parts, The first part of the URI is the Service root URI which points to a site on the Internet and a path to an entry point such as a .svc file. The next part of the URI is the Resource path which identifies a specific object such as a site, a collection (e.g list) or an entry (e.g. item). The final part of the URI are the optional query string parameters that allow you to request special processing instructions such as filtering and sorting.
In SharePoint 2013 the Service root URI contains the URI to the target SharePoint site and then the relative path to the client.svc entry point inside the _vti_bin virtual directory. After that you add the resource path to specify an object such as a site or list. Here's an example of a resource path for the current site.http://contososerver/_vti_bin/client.svc/webSharePoint 2013 allows REST URLS can go through _api folder which cleans up the look of the URLs that need to be built and removes client.svc file name from URL. The URL below is equivalent to the one above and should be preferred.http://contososerver/_api/web
This slides shows example URIs.The the collection of lists for the current site_api/web/listsGet a specific list by its title_api/web/lists/getByTitle('Announcements')Get all the Web templates within the current site which as based on US English_api/web/getAvailableWebTemplates(lcid=1033)