Download presentation
Presentation is loading. Please wait.
1
THE WEB AND WEB SERVICES
„REST in practice“, chapter 11 Lii Nuut Irma Sauga
2
TOPICS SOAP and it’s processing model WSDL and WADL
Security and end-to-end model WS-Trust, WS-Federation HTTPS HTTP status codes and methods REST vs SOAP
3
ARE WEB SERVICES EVIL? SOAP-based became popular in 2000
Changed the enterprise integration landscape Nowadays have perceived heavyweigth and destructive nature
4
SOAP Lightweight Describes for transferring messages: XML envelope
processing model
5
PROCESSING MODEL SOAP over HTTP is the only widely accepted binding to-date Can be routed through multiple intermediaries Low-level messaging protocol
6
HTTP ENVELOPE VS SOAP ENVELOPE
POST /orders HTTP/1.1 Host: restbucks.com Content-Type: application/vnd.restbucks+xml Content-Length: 32064 <order xmlns=" …/> SOAP <soap:Envelope xmlns:soap=" <soap:Header> <wsa:To xmlns:wsa=" </wsa:To> </soap:Header> <soap:Body> <order xmlns=" .../> </soap:Body> </soap:Envelope>
7
HTTP HEADER VS SOAP HEADER
POST /orders HTTP/1.1 Host: restbucks.com Content-Type: application/vnd.restbucks+xml Content-Length: 32064 <order xmlns=" …/> SOAP <soap:Envelope xmlns:soap=" <soap:Header> <wsa:To xmlns:wsa=" </wsa:To> </soap:Header> <soap:Body> <order xmlns=" .../> </soap:Body> </soap:Envelope>
8
HTTP BODY VS SOAP BODY HTTP SOAP POST /orders HTTP/1.1
Host: restbucks.com Content-Type: application/vnd.restbucks+xml Content-Length: 32064 <order xmlns=" …/> SOAP <soap:Envelope xmlns:soap=" <soap:Header> <wsa:To xmlns:wsa=" </wsa:To> </soap:Header> <soap:Body> <order xmlns=" .../> </soap:Body> </soap:Envelope>
9
INTERMEDIARIES AND FAULTS
HTTP and SOAP support intermediaries between sender and receiver of messages Web deals with faults using 4xx and 5xx response codes from HTTP SOAP faults are often used to transfer programming exceptions between services and consumers
10
WSDL Language that provides a model for describing web services
Mostly used as verbose object IDL Has all of the operations that a Web Service supports declared Maps directly onto the equivalent Java code
11
WSDL AND JAVA <wsdl:portType name=″ordering″> <wsdl:operation name=″placeOrder″> <wsdl:input message=″restbucks:Order″/> <wsdl:output message=″restbucks:OrderConfirmation″/> <wsdl:fault name=″fault″ message=″restbucks:OrderException″/> </wsdl:operation> <wsdl:operation name=″cancelOrder″> <wsdl:input message=″restbucks:Cancellation″/> <wsdl:output message=″restbucks:Cancelled″/> <wsdl:fault name=″fault″ message=″restbucks:NoSuchOrderException″/> <wsdl:fault name=″fault″ message=″bank:OrderAlreadyServedException″/> ... </wsdl:portType> public class OrderingService { public OrderConfirmation placeOrder(Order order) throws OrderException { ... } public Cancelled cancelOrder(Cancellation cancellation) throws NoSuchOrderException, OrderAlreadyServedException {
12
WSDL Tight coupling between the service’s contract and its implementation Change to the domain model will likely break existing consumers Solution: Service model between the domain model and the WSDL contract
13
WADL Web Application Description Language
Created to make building and consuming Web- based services accessible to a wide community of programmers Many of the same problems as WSDL Also duplicating the metadata available from the resources
14
SECURITY A suite of XML cryptographic tecniques
Transferring SOAP messages between services Encrypt any part or the whole of the outgoing message End-to-End model
15
END-TO-END MODEL Based on public key cryptography Transfer protocol
Safely away from the Internet
16
SECURING LONG-LIVED CONVERSATIONS
Shared key to transfer multiple messages The secure session starts when the consumer and Web Service established a Security Context Token (SCT)
17
WS-TRUST Token – video store membership cards, passports and OpenID URL- s WS-Trust defines extensions to WS-Security that provide methods for issuing, renewing and validating security tokens.
18
SINGLE SIGN ON WITH WS-FEDERATION
19
HTTPS Creates a secure transport channel
Simpel point-to-point mechanism for transport security
20
RELIABLE MESSAGING Schemas for reducing message delivery errors:
At most once Duplicate messages will not be delivered, but messages may still be dropped. At least once Every message will be delivered, but duplication may occur. Exactly once Every message will be delivered once and once only. In order Messages will be received in the same order they were sent.
21
HTTP STATUS CODES 200 - OK 201 - Created 404 - Not Found
405 - Method Not Allowed 409 - Conflict 500 - Internal Server Error
22
REST WEB SERVICE HTTP METHODS
23
WEB TRANSACTIONS POST Creating a transaction resource
24
WEB TRANSACTIONS GET Listing current participants and participant statuses with GET
25
REST VS SOAP REST Lightweight - not a lot of extra xml markup SOAP
Human Readable Results Easy to build - no toolkits required Yahoo, Flickr SOAP Easy to consume - sometimes Rigid - type checking, adheres to a contract Development tools Google, Blogger
26
THANK YOU! Questions?
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.