Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
(ATS4-DEV04) Protocols as RESTful Services and RESTful URL Routing                                   Jon Hurley           ...
The information on the roadmap and future software development efforts areintended to outline general product direction an...
Summary•   Configuring Protocols as Service Endpoints•   REST•   Protocols as RESTful services•   Long Running Jobs
Pipeline Pilot Integration Points                                                                                         ...
Web Services API & Client SDKs                                  Client   Server  .NET Applications      .NET SDK          ...
Protocols as Web Services• Mapping protocols to Web Services   – “Visual” Services   – Parameter Style   – Document Style
RESTful Services• Representational State Transfer• Typically pass documents (eg XML, JSON) between client  & server that r...
RESTful URIsRESTful URIS refer to resourcesTwo types of URIsCollection - http://example.com/compounds/Element - http://exa...
Zoo Examples• Collection of animals  • Stored in a cache loaded from ‘data/Tables/zoo.txt’  • List, edit, delete animal re...
Demo • Accessing a protocol service from REST   browser plugin
List Service  http://{server}/zoology/animals/  [  {"id":1,"animalname":"aardvark"},  {"id":2,"animalname":"antelope"},  {...
Individual Animal Service  http://{server}/zoology/animals/1  [  {"id":"1","animalname":"aardvark","type  ":"mammal","milk...
List the ‘B’ Animals  http://{server}/zoology/banimals/  [  {"id":3,"animalname":"bass"},  {"id":4,"animalname":"bear"},  ...
List the Animals with an XML format  http://{server}/zoology/canimals/xml  <?xml version="1.0" encoding="UTF-8"?>  <animal...
Defining URL Routes• URL Route definitions are provided in package files   • In your package define the routes in a urls.c...
Defining URL Routes<url REST AUTH>   method GET   request /zoology/animals/   protocol Protocols/Web Services/AcclDev/zoo/...
Reviewing RESTful service protocolsList Protocol
Some Edit URLs• Add new animals   • POST: {root}/zoology/animals/   • Header: Content-type: application/json   • By defaul...
Specifying the return format• Services can use these methods to control the return  format   • Accept Header      •       ...
A Long Running JobIf the action may take more than a few seconds to run then make it a long running    job so it can be po...
Running Job RESTful URLsMethod   URL path               DescriptionGET      /jobs/                 List of the current use...
Accessing RESTful services from Protocols• Use JSON Reader (or XML Reader) or HTTP Connector   • E.g. $(ServerRoot)/zoolog...
Summary• Package developers can configure RESTful endpoints for  protocols• Next Steps   – Get the demo package with which...
Upcoming SlideShare
Loading in …5
×

(ATS4-DEV04) Protocols as RESTful Services and RESTful URL Routing

1,168 views

Published on

Accelrys Enterprise Platform 9.0 includes some significant enhancements to support the deployment of Pipeline Pilot protocols as web services.
This session will bring you up to date on the different styles of web service and options for deployment to end users and web service clients. You will also learn about techniques for publishing services using a standard REST-based model. The session will focus on practical demonstrations of taking Pipeline Pilot protocols and delivering them as REST-based web services.

  • Be the first to comment

  • Be the first to like this

(ATS4-DEV04) Protocols as RESTful Services and RESTful URL Routing

  1. 1. (ATS4-DEV04) Protocols as RESTful Services and RESTful URL Routing Jon Hurley Senior Manager, Platform R&D Jon.Hurley@accelrys.com
  2. 2. The information on the roadmap and future software development efforts areintended to outline general product direction and should not be relied on in makinga purchasing decision.
  3. 3. Summary• Configuring Protocols as Service Endpoints• REST• Protocols as RESTful services• Long Running Jobs
  4. 4. Pipeline Pilot Integration Points Client Integration Build clients that connect to Pipeline Pilot and run protocol services. Web Browser Run Protocol .NET Client Java Client Professional JavaScript Client Command Line Web Port SOAP Client HTTP Client Client Client .NET Client JavaScript Client SDK Java Client SDK SDK Pipeline Pilot Enterprise Server Web Apps Web Services API Admin Portal Help Portal Protocol Runtime Environment VB Script VB Script Run SOAP & Telnet / ODBC / (On (On Java Perl Python .NET SSH / SCP Program HTTP FTP JDBC Client) Server) Java Perl .NET VB Script Cmd Line Classes Scripts ClassesServer Integration REST SOAP Cmd LineExtend pipelines with new Service Service DBscomponents that integrateyour code, data and services.
  5. 5. Web Services API & Client SDKs Client Server .NET Applications .NET SDK Pipeline Pilot Server Java Servlets, JSP Java Applications Java SDK Web Applications JavaScript SDK XML Perl SOAP::Lite & SOAP Protocol APIs Database other SOAP libs Browsers, Http Http Clients Authentication Layer Allows cross-platform access to Pipeline Pilot services
  6. 6. Protocols as Web Services• Mapping protocols to Web Services – “Visual” Services – Parameter Style – Document Style
  7. 7. RESTful Services• Representational State Transfer• Typically pass documents (eg XML, JSON) between client & server that represent state of a resource• Uses existing verbs rather than creating arbitrary function names – GET, PUT, POST, DELETE• Resources identified by URI, so URI mapping required to underlying functions
  8. 8. RESTful URIsRESTful URIS refer to resourcesTwo types of URIsCollection - http://example.com/compounds/Element - http://example.com/compounds/acc1234565 Common Methods Method Purpose GET For retrieving a data resource or a resource collection POST For creating a new resource PUT For replacing a resource PATCH For updating resource content DELETE For removing a resource
  9. 9. Zoo Examples• Collection of animals • Stored in a cache loaded from ‘data/Tables/zoo.txt’ • List, edit, delete animal records • Set of protocols that are exposed as RESTful services• Demonstrated using the Chrome Browser ‘Advanced Rest Client’
  10. 10. Demo • Accessing a protocol service from REST browser plugin
  11. 11. List Service http://{server}/zoology/animals/ [ {"id":1,"animalname":"aardvark"}, {"id":2,"animalname":"antelope"}, {"id":3,"animalname":"bass"}, {"id":4,"animalname":"bear"}, …
  12. 12. Individual Animal Service http://{server}/zoology/animals/1 [ {"id":"1","animalname":"aardvark","type ":"mammal","milk":"1","legs":"4","tail" :"0","eggs":"0","feathers":"0"} ]
  13. 13. List the ‘B’ Animals http://{server}/zoology/banimals/ [ {"id":3,"animalname":"bass"}, {"id":4,"animalname":"bear"}, {"id":5,"animalname":"boar"}, {"id":6,"animalname":"buffalo"} ]
  14. 14. List the Animals with an XML format http://{server}/zoology/canimals/xml <?xml version="1.0" encoding="UTF-8"?> <animals> <animal id="7" animalname="calf" /> <animal id="8" animalname="carp" /> <animal id="9" animalname="catfish" /> <animal id="10" animalname="cavy" /> </animals>
  15. 15. Defining URL Routes• URL Route definitions are provided in package files • In your package define the routes in a urls.conf file • Include a reference to this file in package.conf: … # URL routing configuration Include $(package)/urls.conf
  16. 16. Defining URL Routes<url REST AUTH> method GET request /zoology/animals/ protocol Protocols/Web Services/AcclDev/zoo/Actions/animal/List summary List all animals in the zoo. <url> request /zoology/banimals/ param NameFilter B querystring Off summary List all animals whose name starts with the letter B. </url></url>
  17. 17. Reviewing RESTful service protocolsList Protocol
  18. 18. Some Edit URLs• Add new animals • POST: {root}/zoology/animals/ • Header: Content-type: application/json • By default the body is stored in the first parameter on the protocol (override with _bodyParam in URL route)• Edit an existing animal • PUT: http://meteorbs:9944/zoology/animals/ • With full data record • PATCH: http://meteorbs:9944/zoology/animals/ • With partial data record
  19. 19. Specifying the return format• Services can use these methods to control the return format • Accept Header • Accept: application/json • Format Query String argument • http://{server}/zoology/formanimals/1 • OR • http://{server}/zoology/formanimals/1?format=xml • Overrides the format from the Accept header
  20. 20. A Long Running JobIf the action may take more than a few seconds to run then make it a long running job so it can be polled from the client.In package.conf…<url> method GET request /myapp/slowjob protocol Protocols/Examples/My Protocol param _blocking 0</url>…
  21. 21. Running Job RESTful URLsMethod URL path DescriptionGET /jobs/ List of the current user’s jobsGET /jobs/job-id Details for the specified jobGET /jobs/job-id/status Status code for the job (e.g. running)GET /jobs/job-id/files List of links to job directory filesGET /jobs/job-id/results Results of the jobDELETE /jobs/job-id Release the job (terminate if still running)DELETE /jobs/job-id/stop Stop the current job
  22. 22. Accessing RESTful services from Protocols• Use JSON Reader (or XML Reader) or HTTP Connector • E.g. $(ServerRoot)/zoology/animals/
  23. 23. Summary• Package developers can configure RESTful endpoints for protocols• Next Steps – Get the demo package with which to experiment • testpkg-svc1 – aep_restful_web_services.pdf

×