SharePoint Saturday Boston 2015 - Moving from SOAP to REST
-
Upload
marc-anderson -
Category
Technology
-
view
95 -
download
4
Transcript of SharePoint Saturday Boston 2015 - Moving from SOAP to REST
![Page 1: SharePoint Saturday Boston 2015 - Moving from SOAP to REST](https://reader031.fdocuments.net/reader031/viewer/2022032222/55bec1b2bb61eb267b8b4739/html5/thumbnails/1.jpg)
Moving from SOAP to Rest:You’ve Got to Do It Sometime
Marc D AndersonSharePoint MVPCo-Founder & PresidentSympraxis Consulting LLC
![Page 2: SharePoint Saturday Boston 2015 - Moving from SOAP to REST](https://reader031.fdocuments.net/reader031/viewer/2022032222/55bec1b2bb61eb267b8b4739/html5/thumbnails/2.jpg)
SPS Boston 2015 is made possible by our Sponsors
![Page 3: SharePoint Saturday Boston 2015 - Moving from SOAP to REST](https://reader031.fdocuments.net/reader031/viewer/2022032222/55bec1b2bb61eb267b8b4739/html5/thumbnails/3.jpg)
Who Is Marc?
• Co-Founder and President of Sympraxis Consulting LLC, located in the Boston suburb of Newton, MA, USA. Sympraxis focuses on enabling collaboration throughout the enterprise using the SharePoint application platform.
• Over 30 years of experience in technology professional services and software development. Over a wide-ranging career in consulting as well as line manager positions, Marc has proven himself as a problem solver and leader who can solve difficult technology problems for organizations across a wide variety of industries and organization sizes.
• Author of SPServices• Awarded Microsoft MVP for SharePoint
Server 2011-2015
![Page 4: SharePoint Saturday Boston 2015 - Moving from SOAP to REST](https://reader031.fdocuments.net/reader031/viewer/2022032222/55bec1b2bb61eb267b8b4739/html5/thumbnails/4.jpg)
Session Overview
• If you’ve been developing client side applications or functionality using SPServices and the SOAP Web Services, sooner or later you’ll want to move to REST instead.
• This session takes the patterns shown in my article series on ITUnity and my blog and makes it real with real-world examples. There are some things you can do now to prepare for this eventuality, whether it’s part of an upgrade to SharePoint 2013 or simply because you’ve got “legacy” code that uses SOAP instead of REST.
• We’ll go through the decision points, specific code examples, and better practices.
![Page 5: SharePoint Saturday Boston 2015 - Moving from SOAP to REST](https://reader031.fdocuments.net/reader031/viewer/2022032222/55bec1b2bb61eb267b8b4739/html5/thumbnails/5.jpg)
Why Move from SOAP to REST?
• SOAP• Simple Object Access Protocol• Created 1998 by Dave Winer et al for Microsoft• Discoverability via WSDL• XML-based
• REST• Representational State Transfer• OData protocols• XML or JSON• Much wider usage
Sources: http://en.wikipedia.org/wiki/SOAP#History, http://en.wikipedia.org/wiki/Representational_state_transfer
![Page 6: SharePoint Saturday Boston 2015 - Moving from SOAP to REST](https://reader031.fdocuments.net/reader031/viewer/2022032222/55bec1b2bb61eb267b8b4739/html5/thumbnails/6.jpg)
Services Across SharePoint Versions
Deprecated
Deprecated
Endpoint
/_vti_bin/listdata.svc
/_api
DeprecatedTBD, but unified
None
SOAP REST
![Page 7: SharePoint Saturday Boston 2015 - Moving from SOAP to REST](https://reader031.fdocuments.net/reader031/viewer/2022032222/55bec1b2bb61eb267b8b4739/html5/thumbnails/7.jpg)
SharePoint’s SOAP Services
Source: https://spservices.codeplex.com/wikipage?title=$().SPServices
SO
AP
![Page 8: SharePoint Saturday Boston 2015 - Moving from SOAP to REST](https://reader031.fdocuments.net/reader031/viewer/2022032222/55bec1b2bb61eb267b8b4739/html5/thumbnails/8.jpg)
Conversion Approaches
• Abstract data access (SPServices) calls• Get familiar with promises and asynchronous calls (if you
aren’t already)• Begin using JSON• Convert individual calls – mix and match• Start new development with REST – spackle with CSOM or
SOAP
![Page 9: SharePoint Saturday Boston 2015 - Moving from SOAP to REST](https://reader031.fdocuments.net/reader031/viewer/2022032222/55bec1b2bb61eb267b8b4739/html5/thumbnails/9.jpg)
Abstract Data AccessSO
AP
![Page 10: SharePoint Saturday Boston 2015 - Moving from SOAP to REST](https://reader031.fdocuments.net/reader031/viewer/2022032222/55bec1b2bb61eb267b8b4739/html5/thumbnails/10.jpg)
Replace When ReadySO
AP
RE
ST
![Page 11: SharePoint Saturday Boston 2015 - Moving from SOAP to REST](https://reader031.fdocuments.net/reader031/viewer/2022032222/55bec1b2bb61eb267b8b4739/html5/thumbnails/11.jpg)
How Does SOAP Map to REST?
SO
AP
RE
ST
![Page 12: SharePoint Saturday Boston 2015 - Moving from SOAP to REST](https://reader031.fdocuments.net/reader031/viewer/2022032222/55bec1b2bb61eb267b8b4739/html5/thumbnails/12.jpg)
Mapping GetListItems: The Nitty-Gritty
SOAP Option(SPServices synonym)
REST Comments
ViewFields (CAMLViewFields)
$select Choose the columns you would like to retrieve. With both SOAP and REST we get some data we don’t explicitly request, but by specifying only the columns we need we can reduce the payload sizes.
Query(CAMLQuery)
$filter, $orderby
Specify which items in the list we would like to return and how we would like them sorted.
RowLimit(CAMLRowLimit)
$limit Say how many items matching the Query we would like to receive. In SOAP we can specify 0 to get all matching items; in REST we can omit the parameter to get all the matching items. Otherwise, we can specify any integer as the limit.
ViewName (CAMLViewName)
NA ViewName lets you choose the view you would like to get in the response. There’s no REST equivalent here. I’ve always discouraged using this option in SOAP because it’s too easy to change the view settings and cause unintended consequences.
QueryOptions (CAMLQueryOptions)
NA In SOAP, this lets us specify some options that change how the data is returned to us. For example, we can ask for all of the attachment URLs rather than just a Boolean which tells us that there are attachments.
NA $expand This option in REST has no direct equivalent in SOAP. $expand allows us to indicate that we would like the values for a relationship - rather than just the indices - using a projection. This is important with Lookup columns and Person or Group columns.
![Page 13: SharePoint Saturday Boston 2015 - Moving from SOAP to REST](https://reader031.fdocuments.net/reader031/viewer/2022032222/55bec1b2bb61eb267b8b4739/html5/thumbnails/13.jpg)
Generic Read Function
![Page 14: SharePoint Saturday Boston 2015 - Moving from SOAP to REST](https://reader031.fdocuments.net/reader031/viewer/2022032222/55bec1b2bb61eb267b8b4739/html5/thumbnails/14.jpg)
SPServices: XML vs. JSON
JSO
NSPG
etL
istI
tem
sJso
n
XM
LG
etL
istI
tem
s
![Page 15: SharePoint Saturday Boston 2015 - Moving from SOAP to REST](https://reader031.fdocuments.net/reader031/viewer/2022032222/55bec1b2bb61eb267b8b4739/html5/thumbnails/15.jpg)
SharePoint REST: JSONJS
ON
REST
![Page 16: SharePoint Saturday Boston 2015 - Moving from SOAP to REST](https://reader031.fdocuments.net/reader031/viewer/2022032222/55bec1b2bb61eb267b8b4739/html5/thumbnails/16.jpg)
Demos
We’ll look at live examples showing the different ways we can request data, along with conversion approaches.
![Page 17: SharePoint Saturday Boston 2015 - Moving from SOAP to REST](https://reader031.fdocuments.net/reader031/viewer/2022032222/55bec1b2bb61eb267b8b4739/html5/thumbnails/17.jpg)
Resources
• SharePoint 2013 – CRUD on List Items Using REST Services & jQuery
• Get started with the SharePoint 2013 REST service• Working with lists and list items with REST• Use OData query operations in SharePoint REST requests• OData.org
![Page 18: SharePoint Saturday Boston 2015 - Moving from SOAP to REST](https://reader031.fdocuments.net/reader031/viewer/2022032222/55bec1b2bb61eb267b8b4739/html5/thumbnails/18.jpg)
October 24/25 2015 May 7/8 2016
![Page 19: SharePoint Saturday Boston 2015 - Moving from SOAP to REST](https://reader031.fdocuments.net/reader031/viewer/2022032222/55bec1b2bb61eb267b8b4739/html5/thumbnails/19.jpg)
Contact InformationEmail marc.anderson@sympraxisconsulting.
comTwitter @sympmarc
Blog http://sympmarc.com
SPServices http://spservices.codeplex.com
SPXSLT http://spxslt.codeplex.com
Books http://sympmarc.com/books
The Middle Tier Manifesto
http://bit.ly/middletier