Upload
alberto-lagna
View
10.105
Download
2
Embed Size (px)
DESCRIPTION
Citation preview
Confronto fra web services framework (open source)
>apropos alberto.lagna
• Laureato in informatica, master in telecomunicazioni.• Consulente indipendente, lavoro come architetto
software.• Fornisco consulenza nel design e lo sviluppo di sistemi
enterprise basati su java EE e XML.• Ho un esperienza di più di 10 anni nella realizzazione di
soluzioni ad oggetti distribuiti.• membro del JUGTORINO• Promuovo l’uso di software libero e supporto il
movimento open source.
Confronto fra web services framework (open source)
Due parole sul JUG
• Nasce dall'idea di alcuni appassionati di programmazione e Java nel “lontano” febbraio 2002. Ora siamo più di 200 iscritti
• Lo scopo è quello di favorire l'interscambio di conoscenze informatiche e creare un punto di riferimento nel panorama degli sviluppatori Java in Italia
• La partecipazione alle attività e del tutto gratuita e libera
• Il JUG gestisce, una serie di attivita’ tra cui meeting, scrittura di articoli e review di libri per note case editrici
Confronto fra web services framework (open source)
Agenda
• Il problema
• I requisiti per la soluzione
• Confronto fra framework
• Il mio parere
• Riferimenti
• D&R
Confronto fra web services framework (open source)
“… come la notte in cui tutte le mucche sono nere”
Georg Wilhelm Friedrich Hegelprefazione alla Fenomenologia
dello Spirito
Confronto fra web services framework (open source)
Il problema
• Scenario
Confronto fra web services framework (open source)
Il problema
• Impedance mismatch– Dovuto alla remotizzazione– Tra domini– Tra tecnologie
Confronto fra web services framework (open source)
Il problema
• Gli attori in gioco
Confronto fra web services framework (open source)
I requisiti per la soluzione
• In un sistema enterprise (SOA?)– POJO / XML web services– Standard
• WCF, WS-*, JAX-WS 2.0 e JAXB
– Interoperabilità • doc/lit, a supporto di una risposta complessa
– OpenSource, IDE plugin– MTOM/XOP– JSON, REST
Confronto fra web services framework (open source)
I requisiti per la soluzione
• POJO ws– Sono server e voglio esporre esattamente il
dominio– Problema
• il dominio è un albero• L’XML è un grafo
=> non tutti i fwk sono in grado di “alberizzare” un grafo
– Importante wrapping off-the shelf di un’applicazione esistente
Confronto fra web services framework (open source)
I requisiti per la soluzione
• XML ws– Sono client
• devo colmare il gap con il dominio del server che consumo
• Consumo un WSDL con schema non ad oggetti– Derivante da cattivo disegno– Derivante da binding legacy (PHP, dotNET :) )
– Sono server e voglio semplificare il dominio che espongo
– Importante ricchezza di data binding
Confronto fra web services framework (open source)
I requisiti per la soluzione
Confronto fra web services framework (open source)
I requisiti per la soluzione
• WS Standard– WCF ne supporta molti
• WS-Addressing– formato id messaggi, indirizzi target, azioni
• WS-SecureConversation– encrypting simmetrico
• WS-ReliableMessaging– delivery garantita dei messaggi
• WS-Coordination– protocollo per coordinare applicazioni distribuite
• WS-AtomicTransaction– 2 phase commit su SOAP
• WS-Policy– estensioni al WSDL per supportare i svc di sopra
– I framework java li devono supportare• Per essere interoperabili, per supporto enterprise
Confronto fra web services framework (open source)
I requisiti per la soluzione
• Interoperabilità– WS-I
• an open industry organization chartered to promote ws interoperability
• Basic security profile, a guide for making sure Web services are secure and interoperable.
– Supporto al doc/lit per permettere lo scambio di messaggi complessi
Confronto fra web services framework (open source)
I requisiti per la soluzione
• Supporto doc/lit – per permettere lo scambio di messaggi complessi– rpc/enc approach
• easily exposes simple method calls as web services• model method calls with parameters encoded in XML• creates problems for interoperability, especially with more complex data
structures. • has been effectively deprecated by WS-I BP, and replaced by the doc/lit
approach.
– doc/lit approach• focuses on the actual XML data being • uses W3C XML Schema definitions to fix the XML data formats• up to the participants of interaction to process the XML messages as appropriate
to their needs.
D. Sosnosky
Confronto fra web services framework (open source)
I requisiti per la soluzione
• MTOM – Message Transmission Optimization
Mechanism– Ottimizzazione dei messaggi SOAP– Implementata da XOP (XML-binary
Optimized Packaging) – Importante per interoperabilità e
ottimizzazione negli attachment
Confronto fra web services framework (open source)
I requisiti per la soluzione
• JSON– JavaScript Object Notation– Alternativo alla rappresentazione di oggetti in XML– Basato su JavaScript, ma ne è indipendente– Molto utilizato da GUI AJAX per la semplicità:
• Basta chiamare eval() sulla struttura{ "type": "menu", "value": "File", "items": [ {"value": "New", "action": "CreateNewDoc"}, {"value": "Open", "action": "OpenDoc"}, {"value": "Close", "action": "CloseDoc"} ]}
Confronto fra web services framework (open source)
I requisiti per la soluzione
• REST– Representational State Transfer– The web is populated of resources (sources of specific
information) that can be referred to using a global identifier (a URI). In order to manipulate them, components of the network (clients and servers) communicate via a standardized interface (e.g. HTTP) and exchange representations of these resources.
– Alternativo a SOAP– Grande numero di applicazioni Ajax, mashUp lo richiedono– Standard de facto (Google, Amazon, eBay, Flickr, …)
• Piccola demo• http://www.flickr.com/services/api/
Confronto fra web services framework (open source)
I requisiti per la soluzione
• DEMO – Se leggete questa riga vuol dire che siete
ancora svegli – REST API di Flickr
• http://www.flickr.com/services/api/
Confronto fra web services framework (open source)
I requisiti per la soluzione
• Java standard– JAX-WS 2.0
• Evoluzione di JAX-RPC• Supporto annotation• Migliorato supporto agli schemi utilizzando
JAXB 2.0 binding
Confronto fra web services framework (open source)
La terza generazione dei framework
• Migliorato supporto per doc/lit – diventato mandatorio
• WS-* standard implementati• Ridisegno architetturale
– migliorate performance
• Abbandonato rpc/enc che produceva un xml non usabile
• Supporto REST
Confronto fra web services framework (open source)
Confronto
• Intro dei framework
• Feature matching
• Documentazione disponibile
• Lavori disponibili
• Traffico mailing list
• Maturità/supporto
Confronto fra web services framework (open source)
Introduzione ai fwk
• Axis 2– un application server in miniatura– pluggability di estensioni– hot deploy– flessibilità a runtime– disegnato attorno ad AXIOM (AXIs Object
Model)– multilanguage (C e java)
Confronto fra web services framework (open source)
Introduzione ai fwk
• Apache CXF– Nato dal merge dei progetti Xfire e IONA Celtix– Main focus
• Facilità d’uso, API semplici per un rapido startup nello sviluppo• Supporto agli standard• Integrazione con Spring
– Molti programming models• JAX-WS annotation e senza• Contract first e Java first
– Integrazione con legacy• Non XML bindings come JSON e CORBA• Trasporti diversi (HTTP/S, JMS, local, IIOP)
Confronto fra web services framework (open source)
Introduzione ai fwk
• JiBXSoap– Costruito attorno al JiBX data binding
• MOLTO accurato
– Sviluppato per supportare solo doc/lit– Molto performante
• Da 3 a 5 volte più veloce di Axis2 doc/lit• Fino a 20 volte più veloce di Axis2 rpc/enc
– Miglior supporto per approccio Bottom-up
Confronto fra web services framework (open source)
Introduzione ai fwk
• Spring WS– “make a best practice an easy practice”– Supporto al solo contract first (top down)– Moltissime
• API XML (XML WS) • data binding (POJO WS)
– Spring nativo
Confronto fra web services framework (open source)
Introduzione ai fwk
• JBoss WS– Stack nativo + supporto a CXF– Pluggable WS stack su JBoss
Confronto fra web services framework (open source)
Feature: approccio sviluppo
Axis2 CXF JiBXSoap SpringWS
JBoss WS
Top down ok ok ok ok ok
tooling Non ben doc
raffinato Il migliore maven ok
Bottom up
ok ok ok no ok
tooling ok raffinato Il migliore no ok
Confronto fra web services framework (open source)
Feature: supporto standard
Axis2 CXF JiBXSoap Spring WS JBoss WS
JAX-WS Su AXIOM nativo nativo Più vicino a JAXM
ok
JAXB annotation
sperimentale Generato da tool
ok ok ok
Supporto a nuovi
Tramite modulo Arch flessibile Quelli che chiedono utenti
WSDL 2.0 ok
Security ok ok Integraz acegi ok
Addressing ok ok ok
ReliableMessaging
ok ok
Policy ok
MTOM/XOP Nativo in AXIOM
ok ok ok
Confronto fra web services framework (open source)
Feature
Axis2 CXF JiBXSoap Spring WS JBoss WS
trasporti HTTP/S, JMS, TCP, SMTP/POP, XMPP
HTTP/S, JMS, local, IIOP
HTTP HTTP HTTP
interop Partecipato a molti eventi
WS-I basic profile
Garantita da contract first
Partecipato a molti eventi
POJO ws Doc e anche in spring
Uno dei main focus
Con annotation Con annotation
Data binding(XML ws)
ADB, XMLBeans, JiBX, JaxMe, Castor (sperim)
JAXB e Aegis supportano il 99,99% degli schemi
Solo JiBX, ma molto raffinato
DOM, jDOM, dom4j, XOM, SAX, StAX, XPATH, JAXB, Castor, XMLBeans, JiBX, XstreamTROPPI
SOM, JAXB, SAAJ
Performance StAX pull parser di AXIOM
Streaming XML con perf simili a RMI
migliori
Confronto fra web services framework (open source)
Feature
Axis2 CXF JiBXSoap Spring WS JBoss WS
REST Xml over http
http binding di WSDL 2.0
POX
REST via annotation
In programma
Maturità Usato in molti progetti OS
Incubator di apache
Usato in molti progetti OS anche ESB
alpha ok ok
Sponsor
Doc buona ottima ottima buona buona
Lavori USA
(monster.com)
50 22 2 3 0
Traffico ML
2007
12k 3,5k 3,5k 1,2k
forum
3k
forum
Confronto fra web services framework (open source)
Il mio parere
• Ognuno dei framework ha delle peculiarità
• Scelgo quello che soddisfa i miei requisiti (risolve i miei problemi)
Confronto fra web services framework (open source)
Il mio parere
• Scelgo quello che soddisfa i miei requisiti– Axis 2
• Flessibilità a runtime
– Apace CXF• LA Soluzione standard
– JiBX Soap• XML WS con schema complesso
– Spring WS• Esporre applicazione spring
– JBoss WS• Ho uno stack JBoss
Confronto fra web services framework (open source)
Riferimenti
• Hegel– Prefazione alla Fenomenologia dello Spirito.– http://it.wikiquote.org/wiki/
Georg_Wilhelm_Friedrich_Hegel– http://www.class.uidaho.edu/mickelsen/
texts/Hegel%20Phen/hegel_phen_preface.htm
Confronto fra web services framework (open source)
Riferimenti
• Framework– Axis 2 http://ws.apache.org/axis2/– Apache CXF http://incubator.apache.org/cxf/– JiBX Soap http://jibx.sourceforge.net/jibxsoap/– Spring WS
http://static.springframework.org/spring-ws/site/– JBoss WS http://labs.jboss.com/jbossws/
Confronto fra web services framework (open source)
Riferimenti
• Standard– WS-Addressing
• http://www.w3.org/Submission/ws-addressing/
– WS-Secure Conversation• http://docs.oasis-open.org/ws-sx/ws-
secureconversation/200512/ws-secureconversation-1.3-os.html
– WS-Coordination• http://docs.oasis-open.org/ws-tx/wstx-wscoor-1.1-spec-
os/wstx-wscoor-1.1-spec-os.html
Confronto fra web services framework (open source)
Riferimenti
• Standard– WS-AtomicTransaction
• http://docs.oasis-open.org/wstx/wsat-1.1-spec-wd-01.doc
– WS-Policy• http://www.w3.org/Submission/WS-Policy/
– WS-I Basic Security Profile• http://www.ws-i.org/Profiles/
BasicSecurityProfile-1.0.html
Confronto fra web services framework (open source)
Riferimenti
• Standard– MTOM/XOP
• http://www.w3.org/TR/soap12-mtom/
– JSON• http://it.wikipedia.org/wiki/JSON
– REST• http://en.wikipedia.org/wiki/
Representational_State_Transfer
Confronto fra web services framework (open source)
Riferimenti
• Articoli– The year ahead in Java Web services– Digging into Axis2: AXIOM– Axis2 Data Binding– Axis, Axis 2 and CXF Surveying the Ws landscape– Expose Your POJO-Based Domain Apps as Web
Services– Web Services Stack Comparison– http://del.icio.us/alagna/webservice
Confronto fra web services framework (open source)
D&R