The addition of the REST API to ArcGIS Server at 9.3 was quickly embraced by developers as a simple but powerful way to utilize ArcGIS Server output in application development. Furthermore the new ArcGIS API for Flex enabled the development of true Rich Internet Applications (RIAs) on top of ArcGIS Server. But the Flex Framework in its current state imposes significant limitations on RESTful communication via HTTP: there's just no straightforward way to extract the headers from an HTTP-response in ActionScript3. This means you can't read the id of a newly created resource from the 'Location' header, making it impossible to tell the difference between a '500 Internal Server Error', a '404 Not Found' or a '422 Validation Error'. There's also no way to get the response body for anything outside the 2xx status range. And the only HTTP methods accepted are GET and POST, meaning you cannot use PUT or DELETE, at least not without a proxy. This session focuses on how to unleash the full power of REST for your RIA using a BlazeDS proxy on your application backend to circumvent aforementioned limitations. We'll walk you through the creation of a Java based RESTful Web service using Jersey (an open source reference implementation for JSR-311/JAX-RS), and show how to set up the Flex application on the client side to utilize the complete set of RESTful Web Service HTTP methods and status codes.
5. Whatyou (hopefully) will learn Cover the Basics (no 101) REST BlazeDS Jersey EnableFlextousethefullcapabilitiesof REST See someofourdailyroutinesduringthesoftwaredevelopmentprocess
8. REST Concepts Architectural style, not technology ! Client/server + Request/response approach. Stateless by nature (excellent for distributed systems) Cacheable (naturally supported !) Well known (HTTP) Easy Cool
9. HTTP Client REST Resource HTTP Request RESPONSE CODE 200 (OK) + BODY GET REQUEST
10. HTTP Client REST Resource HTTP Request RESPONSE CODE 200 (OK) + BODY GET REQUEST
11. REST Concepts Resources (nouns)Everythingis a resource ,identified by a URI:- http://www.flickr.com/photos/christianjunk- http://twitter.com/ESRI/favorites
12. HTTP Client REST Resource HTTP Request RESPONSE CODE 200 (OK) + BODY GET REQUEST
13. REST Concepts Uniform interface (verbs)REST reduces the syntax of web servicesto a small fixed set of database-derivedverbs
14. REST Concepts [1] The HEAD method is identical to GET except that the server MUST NOT return a message-body in the response.
15. HTTP Client REST Resource HTTP Request RESPONSE CODE 200 (OK) + BODY GET REQUEST
16. REST Concepts State RepresentationsData and state transferred between client and server:- XML, JSON, Atom, XHTML, etc.
22. With the HTTPServiceComponent you can only do a GET or a POST, no PUT or DELETE the HTTP status code returned in the response is not available (so you can’t get the id of a newly created resource from the ‘Location’ header and you can’t tell the difference between a ‘500 Internal Server Error’, a ‘404 Not Found’ or a ‘422 Validation Error’) there’s also no way to get the response body for anything not in the 2xx range (it fires a fault event for any HTTP response that does not have a status code of 200)
28. Without BlazeDS Flex applications can access back-end data using either the HTTPService or WebService components BlazeDS is a series of data services that provide your Flex applications with additional dataconnectivity options: Remoting Service (directly invoke methods of Java objects deployed in your application server) Message Service (provides a complete publish/subscribe infrastructure allowing Flex clients and the server to exchange messages in real time) HTTP Proxy Service (makecross-domain(!) servicerequests)